Telomere length attrition predicts health span
Telomere length measured in blood cells is predictive of subsequent adult health and survival across a range of vertebrate species. However, we currently do not know whether such associations result from among-individual differences in telomere length determined genetically or by environmental factors early in life, or from differences in the rate of telomere attrition over the course of life. Here, we measured relative leukocyte telomere length (RLTL) multiple times across the entire lifespan of dairy cattle in a research population that is closely monitored for health and milk production and where individuals are only culled in response to health issues and less due to poor milk production than on purely commercial farms. Our results clearly show that the average amount of telomere attrition over an individual’s life, not their average or early life telomere length predicted when an individual was culled. Within-individual telomere length attrition could reflect environmental or physiological insults which may accumulate to predict individual health-span. We also show that animals with more telomere attrition in their first year of life were culled at a younger age, indicating that early life stressors may have a prolonged effect on adult life.
Telomeres, telomere length, longitudinal, lifespan, health-span, qPCR
Telomeres are repetitive DNA sequences that cap the ends of eukaryote linear chromosomes (Blackburn & Gall, 1978; De Lange, 2005). They shorten with the number of cell divisions in vitro as well as in response to oxidative stress and critically short telomeres trigger a DNA damage response that leads to replicative senescence or apoptosis (Harley, Futcher, & Greider, 1990; Olovnikov, 1973; Watson, 1972). In the last decade or so, measures of average telomere length (TL) taken from blood samples have emerged as an exciting biomarker of health across disciplines including biomedicine, epidemiology, ecology and evolutionary biology (Aviv & Shay, 2018; Harrington & Pucci, 2018; Wilbourn et al., 2018). Considerable among- and within-individual variation in TL has been observed, with a general pattern of rapid telomere attrition during early life and a plateau or slower decline thereafter (Aubert & Lansdorp, 2008; Baerlocher, Rice, Vulto, & Lansdorp, 2007). Both genetic and environmental factors, particularly those associated with physiological stress, predict TL in humans and other vertebrates (Angelier, Costantini, Blévin, & Chastel, 2017; Muhammad Asghar et al., 2015; Cherkas et al., 2006; Dugdale, Richardson, & Richardson, 2018; Epel et al., 2004). TL has also been repeatedly associated with health outcomes and subsequent survival in a variety of species, particularly humans and birds (Boonekamp, Simons, Hemerik, & Verhulst, 2013; Wilbourn et al., 2018) and also experimentally elongated TL in mice were associated with a survival advantage (Muñoz-lorente, Cano-martin, & Blasco, 2019). However, a major outstanding question remains to what degree associations between TL and health arise from constitutive differences in TL among individuals set by genes or early life conditions, or from the pattern of within-individual change in TL across individuals’ lives. Estimates of the individual consistency of TL over time in both human and avian literature vary considerably among studies. Some studies report very high correlations within individuals across follow-up measurements (r > 0.8; (Benetos et al., 2013; Boonekamp, Mulder, Salomons, Dijkstra, & Verhulst, 2014)) and high heritability of TL (>0.7; (Atema et al., 2015; Broer et al., 2013)), and have shown in humans that the rank order in TL among individuals remains relatively consistent during adult life (Benetos et al., 2013). This implies most of the variation in blood cell TL occurs at the among-individual level and is predominantly determined by genetics and early-life environment (Atema et al., 2015; Benetos et al., 2013). In stark contrast to this, a growing body of literature studying both humans and non-human vertebrates reports much lower individual repeatability and heritability (Dugdale & Richardson, 2018; Voillemot et al., 2012). These studies demonstrate very high levels of within-individual variation in TL and show that changes in TL across consecutive measurements are highly dynamic (Fairlie et al., 2015; Farzaneh-Far et al., 2010). Although on average TL attrition over time tends to be the norm, a growing number of studies have found that a substantial proportion of individuals show telomere elongation over time and it is now clear this cannot be ascribed solely to measurement error (Bateson & Nettle, 2016; Spurgin et al., 2018). A recent cross-sectional study has shown that amongst different avian and mammal species, those with a fast telomere attrition rate have a shorter life span but without investigating if telomere attrition rate within individuals is predictive of their life span within the population as well (Whittemore, Vera, Martínez-nevado, Sanpera, & Blasco, 2019). To date, few studies have directly compared the power of an individual’s average or early life TL versus the pattern of within-individual change in TL to explain variation in measured associated with health and fitness. In Seychelle warblers and Alpine swifts both telomere length and telomere attrition rate were associated with survival (Barrett, Burke, Hammers, Komdeur, & Richardson, 2013; Bize, Criscuolo, Metcalfe, Nasir, & Monaghan, 2009) while in jackdaw nestlings telomere length was not predictive of lifespan but early life telomere attrition- accelerated by early life stress- was (Boonekamp, Mulder, Salomons, Dijkstra, & Verhulst, 2014). Contrary, in a study on elderly humans, there was an association between telomere length and longevity, but not between telomere attrition and life span (Yuan, Kronström, Hellenius, Cederholm, & Xu, 2018). To our knowledge no studies so far has investigated the relationship between telomere attrition and life span with data spanning the entire typical lifespan of the studied individuals. Here, we use an exceptionally detailed longitudinal study of dairy cattle to show that a life-long tendency for greater telomere attrition, rather than average TL, predicts productive lifespan, a metric closely linked to long-term health.
We used samples and data collected as part of the long-term study of Holstein Friesian dairy cattle kept at the Crichton Royal Research Farm in Dumfries, Scotland (Veerkamp, Simm, & Oldham, 1994). This herd, consisting of around 200 milking cows plus their calves and replacement heifers, has been regularly monitored since 1973 for a broad range of measurements, such as body weight, feed intake, signs of disease (health events), milk yield, productive lifespan and reasons for culling (Veerkamp et al., 1994). The cows are separated into two distinct genetic groups (a group that has been strongly selected for high milk fat and protein yield, and a control group) and are randomly allocated to two different diets (a high forage, low energy diet vs. a low forage, high energy diet group) (Veerkamp et al., 1994). Blood samples are routinely collected from members of the herd, initially within 15 days after birth and then approximately annually thereafter. Productive lifespan, which is the age of an individual at culling, is recorded for every animal together with a reason for culling. In this and other commercial livestock herds, culling is a response to diseases such as reproductive problems, lameness and mastitis. Although productive lifespan in livestock is clearly not a comparable measure to longevity in study of humans or wild vertebrates, we argue that because age at culling is tightly linked to health, it can be considered as a proxy for health-span, over and above its obvious importance as a metric of agricultural productivity. We have previously reported for this herd that TL is moderately repeatable and heritable, but that individual slopes relating TL to age vary considerably among individuals (Seeker et al., 2018; Seeker et al., 2018). We have also reported that TL at the age of one year predicts productive lifespan in this population of dairy cattle (Seeker et al., 2018). Here, we test the relationships between lifetime average TL as well as lifetime change in TL with productive lifespan.
At the Crichton Royal Farm, 200 milking cows plus their calves and replacement heifers are kept at any time. One half of the milking cows belong to a genetic line that has been selected for high milk protein and fat yield (S), while the other half is deliberately maintained on a UK average productivity level (C). Calves and heifers of both genetic lines are kept together. After first calving all cows are randomly allocated to a high forage (HF) or low forage (LF) diet. The LF diet is energy richer than the HF diet and whilst the LF cows are housed continuously, the HF cows graze over the summer months. All cows are milked three times daily and milk yield is recorded. In the present study, these measurements were used to calculate an average milk production in kg per cow including all started lactations and it is referred to this below as “average lifetime milk production” (Figure S1). Every day cows leave the milking parlour over a pressure plate which detects signs of lameness. Behaviour and health events are documented after visual detection by farm workers (Figure S2). At the end of the animal’s life its productive lifespan and a reason for culling are recorded. Productive lifespan is the time from birth to culling in days and is a proxy for the health span of the animal, because all animals that remain healthy enough to generate profit for the farmer remain in the herd. The most frequent reasons for culling were reproductive problems, mastitis, lameness and injuries caused by accidents (Figure S3). Routine blood sampling takes place initially shortly after birth and then annually in spring. Because of this sampling routine and because calves are being born all year round, age at sampling and sampling intervals vary for adult animals (Figure S1). Further information about the animal population can be found in Supplementary File 2.
DNA from whole blood samples was extracted with the DNeasy Blood and Tissue spin column kit (QIAGEN) and telomere length was measured by qPCR as previously described (Seeker et al., 2016; Seeker et al., 2018; Seeker et al., 2018; Seeker, Holland, Psifidi, Banos, & Nussey, 2015). The repeatability of the assay (see Supplementary File 2 for how repeatability was calculated) was 80% and therefore delivers robust results for further interpretation (Nettle, Seeker, Nussey, Froy, & Bateson, 2019). A full description of our DNA extraction and qPCR protocols including quality control steps can also be found in Supplementary File 2.
We have shown before that our RLTL data are significantly affected by qPCR plate and qPCR row (Seeker et al., 2016; Seeker et al., 2018). To account for those known sources of measurement error, we used the residuals of a linear model that corrected all RLTL measurements for qPCR plate and row, by fitting plate and row as fixed factors in the model. These residual RLTL measures were used in all subsequent calculations and models of telomere dynamics. RLTL change was calculated as the difference between two subsequent adjusted RLTL measurements within individuals (RLTL change = RLTLt - RLTLt-1). To investigate which factors affect the direction and amount of RLTL change, a linear mixed model was fitted with RLTL change as response variable and animal identity as random effect. To capture the experimental design, feed group and genetic group were added as fixed effects to all models. Also, the time difference between consecutive samplings in days was fitted as a covariate, becasue sampling intervals varied within and between animals. The following additional factors were tested for their relationship with RLTL change: birth year of the animal (fixed effect), year of sampling (fixed effect), age at sampling (at time t), and the occurrence of a health event within two weeks before or after sampling (at time t).
Becasue of our study design, the first two sample years only included RLTL change in young animals which has previously been shown to follow a different pattern. To exclude that a year effect was driven by the difference in juvenile and adult RLTL dynamics, the full model was repeated while excluding the first two sample years.
Birth year and the occurrence of a heath event were not statistically significant (p>0.05) and therefore eliminated from the model. In the reduced model, age was first fitted as a covariate (age in years) than as a fixed effect (factor with two levels: younger vs. older than 1 year) and model fit was compared using AIC values. Because we wanted to investigate if milk productivity was associated with RLTL change, the best-fitting model of RLTL change was repeated for 918 change measurements of 253 animals for which milk productivity measurements were available and average lifetime milk production re-scaled by dividing it by 1000 was fitted as additional covariate.
To investigate the association between RLTL change and productive lifespan we first focussed on RLTL change within the first year of life by only considering two RLTL measurements per animal: The first was taken shortly after birth and the second at the approximate age of one year. The change between those measurements was noramlly distributed and tested as an explanatory variable in a Cox proportional hazard model of productive lifespan.
Our data shows similar to other longitudinal studies with more than two measurements no constant attrition, maintenance or elongation, but more complex dynamics with short term changes in both directions. Example individual RLTL dynamics are shown for all cows with at least seven RLTL measurements in our dataset in figure S4. The complexity of telomere dynamics (which cannot be explained by measurement error alone) means that it is impossible to compare lifelong telomere dynamics by simply comparing slopes. To still be able to test how life-long telomere dynamics are associated with productive lifespan, we calculated three average metrics of RLTL dynamics over every individual’s lifetime: Firstly, the average of all their RLTL measures (“mean RLTL”) which investigates if animals with on average longer RLTL have a survival advantage, secondly, the average of all their RLTL change measures (“mean RLTL change”) and thirdly, the average of all their absolute RLTL change measures (“mean absolute RLTL change”). While mean RLTL change captures the direction and magnitude of RLTL changes, mean absolute RLTL change describes just the magnitude of change without considering its direction because we were interested to investigate if more change in either direction may be correlated with adverse effects. Figure S5 visualises the reasoning behind calculating these three measures of lifetime telomere length dynamics which are not surprisingly moderately correlated with one another (r ranged from -0.53 to 0.30, Figure S6). We used Cox proportional hazard models of productive lifespan that also included mean milk production as covariate and included mean RLTL, mean RLTL change and mean absolute RLTL change as explanatory variables first separately and then together to test their association with productive lifespan first separately, then while accounting for the effect of the other two measures. We have reported before that on average RLTL shortens in this population of dairy cattle within the first year of life while remaining relatively stable thereafter at the population level (Seeker et al., 2018; Seeker, et al., 2018). We were concerned that the initial RLTL attrition may contribute proportionally more to overall RLTL shortening in short-lived animals with less follow up samples which may explain a correlation of more telomere attrition with a shorter productive lifespan. To ensure the relationship was not entirely driven by this correlation, we tested all models again while excluding all measurements that were taken shortly after birth and then also while excluding all animals with less than three RLTL measurements. Lastly, we tested if the previously reported effect of RLTL at the age of one year on productive lifespan (Seeker, Ilska, Psifidi, Wilbourn, Underwood, Fairlie, Holland, Froy, Salvo-Chirnside, et al., 2018) remained statistically significant when tested in a Cox proportional hazard model together with milk productivity and mean RLTL change. All statistical analyses were performed in R studio with R 3.1.3. (R Core Team, 2014). Mixed-effects models were implemented using the ‘lme4’ library (Bates, Mächler, Bolker, & Walker, 2015), while Cox proportional hazard models were implemented using the library survival (Therneau, 2015) and figures were generated with the library ‘ggplot2’ (Wickham, 2009).
We used blood samples collected between 2008 and 2014 to measure relative leukocyte telomere length (RLTL) by monoplex qPCR in 1,325 samples from 305 individuals. On average 4.3 (range: 2-8) telomere measurements were made of each individual, including the first measurement within 15 days of birth and a variable number of subsequent measures (Figure S7 A). RLTL measures, adjusted for qPCR plate and row (see Methods), were approximately normally distributed (Figure S7 B).
From these longitudinal data we calculated 1,020 measures of change in adjusted RLTL across subsequent measurements of individual animals. RLTL change also showed approximately a normal distribution with a mean statistically significantly smaller than zero (Figure S7 C; t = -5.844, df = 1019, p-value <0.001) indicating that telomere shortening overall predominated.
Animals varied in the amount and direction of RLTL change across consecutive measurements, with a fairly even proportion of individuals increasing (43.5%) and decreasing (56.5%) in RLTL over time.
We next ran a series of models to test whether known individual, genetic and environmental variables could explain variation in RLTL change. Only sample year was significant in these models; age in years, genetic group, feed group, birth year, the time difference between samplings in days, and the occurrence of a health event within two weeks of sampling were not significant (Table S1). However, when age was fitted a factor with two levels for animals younger or oler than 1 year, it became clear that younger anumals show significantly more telomere length attrition (Tables S2 and S3). Fitting age as a covariate (age in years) and not a two-level factor lead to a slightly better although not statistically significant model fit and was therefore realised in all following models (AICs: -601.82 vs. -600.99).
We have previously shown that, on average across this population, RLTL declined over the first year of life but showed no systematic change with age thereafter (Seeker, Ilska, Psifidi, Wilbourn, Underwood, Fairlie, Holland, Froy, Salvo-Chirnside, et al., 2018; Seeker, Ilska, Psifidi, Wilbourn, Underwood, Fairlie, Holland, Froy, Bagnall, et al., 2018). Consistent with this, we found that average RLTL change across consecutive measurements was only significantly negative (indicating a tendency for attrition over time) when the first measurement was made close to birth and the follow up measurement at the age of around 1 year (Figure 1A, estimate= -0.115, SE= 0.01, t= -11.512, p<0.001; Table S3).
Average lifetime milk productivity was not statistically associated with RLTL change, when tested in a subset of animals (253 animals with 918 RLTL change measurements) that had milk productivity measurements available (Table S2).
Consecutive RLTL measurements made on the same individual were overall moderately positively and significantly correlated (r=0.38, p<0.001; Figure 1B), supporting our previously reported moderate and significant individual repeatability of RLTL (Seeker, Ilska, Psifidi, Wilbourn, Underwood, Fairlie, Holland, Froy, Bagnall, et al., 2018). We next tested whether measured RLTL change predicted the productive lifespan of cattle. Of all dead cows (N=244) the vast majority (N=241) had survived to their first lactation, but there was considerable variation in productive lifespan beyond this point (Figure S7 D). We used a Cox proportional hazard model to test whether early life RLTL change between two samples, one taken shortly after birth and the next at an approximate age of one year, predicted productive lifespan and found that greater early life RLTL attrition was associated with a shorter productive lifespan (N= 291, coefficient= -1.141, SE= 0.391, p= 0.004, Figure 2, Table S4). When each measure of lifetime RLTL dynamics was tested in a separate cox proportional hazard model of productive lifespan, mean RLTL did not significantly predict productive lifespan (coefficient= 0.341, SE= 0.591, p=0.564, Figure 2B , Table S4), but both mean RLTL change (coefficient= -5.209, SE= 0.845, p<0.001; Figure 2D, Table S4) and mean absolute RLTL change (coefficient= 2.939, SE= 0.970, p=0.002; Figure 2C, Table S4) were significantly associated with productive lifespan. When all three measures of lifetime RLTL dynamics were included in the same model only mean RLTL change remained significant (coefficient = -4.758, SE= 1.018, p<0.001; Table S4). This implies that the relationship between productive lifespan and mean absolute RLTL change was largely due to covariance with mean RLTL change. Thus, individuals that experienced greater telomere attrition over their lifetimes had a shorter productive lifespan and direction of RLTL change (rather than simply absolute magnitude) was an important aspect of this relationship. To visualise the relationship between RLTL change measurements and productive lifespan using Kaplan-Meier plots (Figure 2), continuous RLTL measures were transformed to a discrete scale by grouping them into tertiles (Figure S8). Cox proportional hazard models based on these tertile groupings of RLTL measures showed similar results to those reported above (Figure 2). The relationship between mean RLTL change and productive lifespan was robust to the inclusion of milk production (a physiological stressor, which is positively associated with productive lifespan as cows with a low milk yield are more likely to be culled at a younger age) in the model (Table S5). If RLTL declines most within the first year of life (as Figure 1A indicates), the association between change in RLTL and productive lifespan may be driven by the fact that this initial decline contributes relatively more to estimates of mean RLTL change in shorter-lived individuals than in animals that have more follow up samples with more moderate change measures available. We therefore repeated the analysis excluding the early life RLTL measurements and found that mean RLTL change still predicted productive lifespan (N=253, coefficient= -5.056, SE= 1.315, p<0.001, Table S6). The relationship between mean RLTL change and productive lifespan also remained statistically significant, when animals with less than 3 samples were excluded from the analysis (N= 213, coefficient= -3.47, SE= 1.34, Wald test = 6.7 on 1 df, p= 0.01) and when RLTL at 1 year of age (which we previously found to predict productive lifespan (Seeker, Ilska, Psifidi, Wilbourn, Underwood, Fairlie, Holland, Froy, Salvo-Chirnside, et al., 2018)) was included in the models (Table S7).
Mean rate of RLTL change and mean rate of absolute RLTL change correlate well with mean RLTL change and mean absolute RLTL change. THerefore, they do not seem to add much to the analysis. Only mean RLTL, mean RLTL change and mean absolute RLTL change are used.
We have presented, to our knowledge, the first demonstration in any vertebrate that lifelong variation in telomere attrition rather than variation in constitutive individual differences in average telomere length predict health outcomes and lifespan. While there is mounting evidence that telomere length predicts mortality, health and life history in humans as well as birds and non-human mammals (Bakaysa et al., 2007; Bichet et al., 2019; Boonekamp et al., 2013; Cawthon, Smith, O’Brien, Sivatchenko, & Kerber, 2003; Fairlie et al., 2015; Mark Haussmann, Winkler, & Vleck, 2005; Heidinger et al., 2012; Nettle, Monaghan, Boner, Gillespie, & Bateson, 2013; Voillemot et al., 2012; Wilbourn et al., 2018), very few studies have been able to accumulate long-term longitudinal data capable of differentiating the role of among- and within-individual variation in TL to such relationships. Our data support the contention that within-individual directional change over time in TL is more important than stable among-individual differences in predicting overall health. Individuals in our study which showed a greater propensity to shorten RLTL across sampling points were culled earlier, mainly due to health issues described above. There was no relationship between productive lifespan and an individual’s average RLTL. Future studies will show how well our results generalise to other systems as telomere biology is variable amongst species. Cattle telomere biology seems to be similar to other ruminants, horses, zebras, tapirs some whales and primates including humans in that they have relatively short telomeres and a tight regulation of telomerase expression (Gomes et al., 2011). If our results generalise to some of those other systems and contexts, they have important implications for the utility of TL as a biomarker of health and fitness, lending support to the idea that TL change is an indirect marker reflecting past physiological insults and stress rather than an indicator of constitutive or genetically-based robustness to life’s challenges. Our data also highlight the importance of collecting longitudinal telomere measurements, by showing that in some species it is within-individual change over time in TL that carries the important biological signal.
Our study animals varied considerably in the magnitude and direction of RLTL change across consecutive sampling points. This is in accordance with other longitudinal studies that have reported a wide variation in TL change, alongside evidence that a large proportion of individuals show telomere lengthening over time (Bize et al., 2009; Chen et al., 2011; Farzaneh-Far et al., 2010; Gardner et al., 2005; Huzen et al., 2014; Kark, Goldberger, Kimura, Sinnreich, & Aviv, 2012; Nordfjäll et al., 2009; Shalev et al., 2012; Steenstrup et al., 2013; Svenson et al., 2011). Whilst the vast majority of studies linking telomere length with health and fitness remain cross-sectional, a growing number of longitudinal studies have found that individuals that lose more TL across samples have reduced survival prospects (Barrett et al., 2013; Bize et al., 2009; Boonekamp et al., 2014; Goglin et al., 2016). However, these studies tend to involve two samples taken per individual or a follow-up period that represents only a small fraction of the total lifespan of the study species. A lifelong study of TL and lifespan in zebra finches found that TL measured in early life was a better predictor of subsequent survival than measures from later life, but the role of change in telomere length across sampling points was not investigated (Heidinger et al., 2012). Here we show that, despite TL being moderately consistent across the lifetimes of individuals, there remains considerable within-individual variation and the pattern of change in TL over an individual’s life is highly dynamic. Short-term environmental fluctuations impacting TL dynamics could be responsible and may impact individuals in different ways. In humans many lifestyle factors such as socio-economic status, psychological stress, smoking and body mass index are known to influence telomere length (Cherkas et al., 2008; Epel, Daubenmier, Moskowitz, Folkman, & Blackburn, 2009; Huzen et al., 2014; Kim et al., 2009; Shalev et al., 2012). In animal studies chronic infection and exposure to stressful situations have been linked to telomere shortening (Asghar, Hasselquist, Zehtindjiev, Westerdahl, & Bensch, 2015; Nettle et al., 2013; Reichert et al., 2014). Whilst we were unable to identify variables other than age which predicted within-individual TL change in our study system, individuals with a greater propensity to lose TL over time had shorter productive lives, implying changes in TL reflect important environmental or physiological variation linked to health. From a telomere biology perspective, it would be interesting to investigate changes not only in mean TL but also in its variance over time, preferentially using a technique like STELA or TESLA that allows the detection of critically short telomeres as well (Baird, Rowson, Wynford-Thomas, & Kipling, 2003; Lai et al., 2017). However, if the focus is to find good markers for animal breeding and health those techniques are not economically practical.
Our results have important implications for the application of TL as a biomarker within animal breeding and health. Productive lifespan describes the time from birth to culling and differs from measures of “longevity” or “lifespan” in human or wild animal studies because the animals are culled for reasons relating mainly to health and productivity. From an animal production perspective, a biomarker which could predict the productive lifespan of livestock from a relatively early age would represent an exciting target phenotype for use in selective breeding if heritable or for use in animal welfare monitoring if influenced by the environment. In the present study we showed that RLTL attrition predicted productive lifespan. The fact that both early life and lifelong RLTL shortening predicts earlier culling does support recent suggestions that TL may be useful as a biomarker of stress and welfare in livestock (Melissa Bateson, 2016; Brown, Dechow, Liu, Harvatine, & Ott, 2012). Many previous studies in birds and humans have found that experience of past stress is associated with shorter telomeres (Angelier, Vleck, Holberton, & Marra, 2013; Asghar et al., 2015; Cherkas et al., 2006; Entringer et al., 2011; Entringer et al., 2013; Epel et al., 2004; Haussmann, Longenecker, Marchetto, Juliano, & Bowden, 2012; Nettle et al., 2017). In our study, cattle showing RLTL attrition may be those that have experienced some form of recent immediate stress or minor infection. Repeated bouts of such stress, reflected by higher average RLTL attrition through life, may result in the development of health issues that lead to culling. Whilst the results of the present study suggest that longitudinal RLTL change itself may be a useful biomarker of health and welfare in livestock, a key area for further study is the causes of variation in RLTL change, as these may help us to understand sources of physiological stress for domestic animals and help improve animal welfare and productivity.
We thank everyone involved in collecting blood samples on the Crichton farm, particularly Hannah Dykes and Isla McCubbin. We also thank the SynthSys facility at the University of Edinburgh, particularly Eliane Salvo-Chirnside, for their support with the liquid handling robot. Our work was funded by the Biotechnology and Biological Sciences Research Council (BB/L007312/1; http://www.bbsrc.ac.uk/) awarded to GB. LS received a studentship from Scotland’s Rural College (http://www.sruc.ac.uk/).
Angelier, F., Costantini, D., Blévin, P., & Chastel, O. (2017). Do glucocorticoids mediate the link between environmental conditions and telomere dynamics in wild vertebrates? A review. General and Comparative Endocrinology, 256, 99–111. https://doi.org/10.1016/j.ygcen.2017.07.007
Angelier, F., Vleck, C. M., Holberton, R. L., & Marra, P. P. (2013). Telomere length, non-breeding habitat and return rate in male American redstarts. Functional Ecology, 27(2), 342–350. https://doi.org/10.1111/1365-2435.12041
Asghar, M, Hasselquist, D., Zehtindjiev, P., Westerdahl, H., & Bensch, S. (2015). Hidden costs of infection: Chronic malaria accelerates telomere degradation and senescence in wild birds, 347(6220), 9–12.
Asghar, Muhammad, Bensch, S., Tarka, M., Hansson, B., Hasselquist, D., & Asghar, M. (2015). Maternal and genetic factors determine early life telomere length. Proceedings of the Royal Society B.
Atema, E., Mulder, E., Dugdale, H. L., Briga, M., van Noordwijk, A. J., & Verhulst, S. (2015). Heritability of telomere length in the Zebra Finch. Journal of Ornithology, 156(4), 1113–1123. https://doi.org/10.1007/s10336-015-1212-7
Aubert, G., & Lansdorp, P. M. (2008). Telomeres and aging. Physiological Reviews, 88(2), 557–579. https://doi.org/10.1152/physrev.00026.2007
Aviv, A., & Shay, J. W. (2018). Reflections on telomere dynamics and ageing-related diseases in humans. Philosophical Transactions of the Royal Society of London. Series B, Biological Sciences, 373(1741), 20160436. https://doi.org/10.1098/rstb.2016.0436
Baerlocher, G. M., Rice, K., Vulto, I., & Lansdorp, P. M. (2007). Longitudinal data on telomere length in leukocytes from newborn baboons support a marked drop in stem cell turnover around 1 year of age. Aging Cell, 6(1), 121–123. https://doi.org/10.1111/j.1474-9726.2006.00254.x
Baird, D. M., Rowson, J., Wynford-Thomas, D., & Kipling, D. (2003). Extensive allelic variation and ultrashort telomeres in senescent human cells. Nature Genetics, 33(2), 203–207. https://doi.org/10.1038/ng1084
Bakaysa, S. L., Mucci, L. a., Slagboom, P. E., Boomsma, D. I., Mcclearn, G. E., Johansson, B., & Pedersen, N. L. (2007). Telomere length predicts survival independent of genetic influences. Aging Cell, 6(6), 769–774. https://doi.org/10.1111/j.1474-9726.2007.00340.x
Barrett, E. L. B., Burke, T. a., Hammers, M., Komdeur, J., & Richardson, D. S. (2013). Telomere length and dynamics predict mortality in a wild longitudinal study. Molecular Ecology, 22(1), 249–259. https://doi.org/10.1111/mec.12110
Bates, D., Mächler, M., Bolker, B., & Walker, S. (2015). Fitting Linear Mixed-Effects Models Using lme4. Journal of Statistical Software, 67(1). https://doi.org/10.18637/jss.v067.i01
Bateson, M, & Nettle, D. (2016). The telomere lengthening conundrum - it could be biology. Aging Cell, 2016, 1–8. https://doi.org/10.1111/acel.12555
Bateson, Melissa. (2016). Cumulative stress in research animals: Telomere attrition as a biomarker in a welfare context? BioEssays, 38(2), 201–212. https://doi.org/10.1002/bies.201500127
Benetos, A., Kark, J. D., Susser, E., Kimura, M., Sinnreich, R., Chen, W., … Aviv, A. (2013). Tracking and fixed ranking of leukocyte telomere length across the adult life course. Aging Cell, 12(4), 615–621. https://doi.org/10.1111/acel.12086
Bichet, C., Bouwhuis, S., Bauch, C., Verhulst, S., Becker, P. H., & Vedder, O. (2019). Telomere length is repeatable, shortens with age and reproductive success, and predicts remaining lifespan in a long‐lived seabird. Molecular Ecology, 2020(29), 429–441. https://doi.org/https://doi.org/10.1111/mec.1533
Bize, P., Criscuolo, F., Metcalfe, N. B., Nasir, L., & Monaghan, P. (2009). Telomere dynamics rather than age predict life expectancy in the wild. Proceedings of the Royal Society of London B, 276(1662), 1679–1683. https://doi.org/10.1098/rspb.2008.1817
Blackburn, E., & Gall, J. (1978). A Tandemly Repeated Sequence at the Termini of Extrachromosomal Ribbosomal RNA Genes in Tetrahymena. Journal of Molecular Biology, (120), 33–53.
Boonekamp, J., Mulder, G., Salomons, H. M., Dijkstra, C., & Verhulst, S. (2014). Nestling telomere shortening, but not telomere length, reflects developmental stress and predicts survival in wild birds. Proceedings of the Royal Society B: Biological Sciences, 281(April), 20133287. https://doi.org/http://dx.doi.org/10.1098/rspb.2013.3287
Boonekamp, J., Simons, M. J. P., Hemerik, L., & Verhulst, S. (2013). Telomere length behaves as biomarker of somatic redundancy rather than biological age. Aging Cell, 12(2), 330–332. https://doi.org/10.1111/acel.12050
Boonekamp, J., Mulder, G., Salomons, H., Dijkstra, C., & Verhulst, S. (2014). Nestling telomere shortening, but not telomere length, reflects developmental stress and predicts survival in wild birds. Proceedings of the Royal Society B: Biological Sciences, 281(April), 20133287. https://doi.org/http://dx.doi.org/10.1098/rspb.2013.3287
Broer, L., Codd, V., Nyholt, D. R., Deelen, J., Mangino, M., Willemsen, G., … Boomsma, D. I. (2013). Meta-analysis of telomere length in 19 713 subjects reveals high heritability, stronger maternal inheritance and a paternal age effect. European Journal of Human Genetics, 21(10), 1163–1168. https://doi.org/10.1038/ejhg.2012.303
Brown, D. E., Dechow, C. D., Liu, W. S., Harvatine, K. J., & Ott, T. L. (2012). Hot topic: Association of telomere length with age, herd, and culling in lactating Holsteins. Journal of Dairy Science, 95(11), 6384–6387. https://doi.org/10.3168/jds.2012-5593
Cawthon, R., Smith, K., O’Brien, E., Sivatchenko, A., & Kerber, R. (2003). Association between telomere length in blood and mortality in people aged 60 years or older. The Lancet, 361(9355), 393–395. https://doi.org/10.1016/S0140-6736(03)12384-7
Chen, W., Kimura, M., Kim, S., Cao, X., Srinivasan, S. R., Berenson, G. S., … Aviv, A. (2011). Longitudinal versus cross-sectional evaluations of leukocyte telomere length dynamics: Age-dependent telomere shortening is the rule. Journals of Gerontology - Series A Biological Sciences and Medical Sciences, 66 A(3), 312–319. https://doi.org/10.1093/gerona/glq223
Cherkas, L F, Aviv, a, Valdes, a M., Hunkin, J. L., Gardner, J. P., Surdulescu, G. L., … Spector, T. D. (2006). The effects of social status on biological aging as measured by white-blood-cell telomere length. Aging Cell, 5(5), 361–365. https://doi.org/10.1111/j.1474-9726.2006.00222.x
Cherkas, Lynn F, Hunkin, J. L., Kato, B. S., Richards, J. B., Gardner, J. P., Surdulescu, G. L., … Aviv, A. (2008). The association between physical activity in leisure time and leukocyte telomere length. Archives of Internal Medicine, 168(2), 154–158. https://doi.org/10.1001/archinternmed.2007.39
De Lange, T. (2005). Shelterin: The protein complex that shapes and safeguards human telomeres. Genes and Development, 19(18), 2100–2110. https://doi.org/10.1101/gad.1346005
Dugdale, H. L., & Richardson, D. S. (2018). Heritability of telomere variation: it’s all about the environment! Philosophical Transactions of the Royal Society B, 373(1741), 20160450. https://doi.org/10.1098/rstb.2016.0450
Entringer, S., Epel, E. S., Kumsta, R., Lin, J., Hellhammer, D. H., Blackburn, E. H., … Wadhwa, P. D. (2011). Stress exposure in intrauterine life is associated with shorter telomere length in young adulthood. Proceedings of the National Academy of Sciences, 108(33), E513–E518. https://doi.org/10.1073/pnas.1107759108
Entringer, Sonja, Epel, E. S., Lin, J., Buss, C., Shahbaba, B., Blackburn, E. H., … Wadhwa, P. D. (2013). Maternal psychosocial stress during pregnancy is associated with newborn leukocyte telomere length. American Journal of Obstetrics and Gynecology, 208(2), 134.e1-134.e7. https://doi.org/10.1016/j.ajog.2012.11.033
Epel, E., Daubenmier, J., Moskowitz, J. T., Folkman, S., & Blackburn, E. (2009). Can meditation slow rate of cellular aging? Cognitive stress, mindfulness, and telomeres. Annals of the New York Academy of Sciences, 1172, 34–53. https://doi.org/10.1111/j.1749-6632.2009.04414.x
Epel, E. S., Blackburn, E. H., Lin, J., Dhabhar, F. S., Adler, N. E., Morrow, J. D., & Cawthon, R. M. (2004). Accelerated telomere shortening in response to life stress. Proceedings of the National Academy of Sciences, 101(49), 17312–17315. https://doi.org/10.1073/pnas.0407162101
Fairlie, J., Holland, R., Pilkington, J. G., Pemberton, J. M., Harrington, L., & Nussey, D. H. (2015). Lifelong leukocyte telomere dynamics and survival in a free-living mammal. Aging Cell, 140–148. https://doi.org/10.1111/acel.12417
Farzaneh-Far, R., Lin, J., Epel, E., Lapham, K., Blackburn, E., & Whooley, M. A. (2010). Telomere length trajectory and its determinants in persons with coronary artery disease: Longitudinal findings from the heart and soul study. PLoS ONE, 5(1). https://doi.org/10.1371/journal.pone.0008612
Gardner, J. P., Li, S., Srinivasan, S. R., Chen, W., Kimura, M., Lu, X., … Aviv, A. (2005). Rise in insulin resistance is associated with escalated telomere attrition. Circulation, 111(17), 2171–2177. https://doi.org/10.1161/01.CIR.0000163550.70487.0B
Goglin, S. E., Farzaneh-Far, R., Epel, E. S., Lin, J., Blackburn, E. H., & Whooley, M. A. (2016). Change in leukocyte telomere length predicts mortality in patients with stable coronary heart disease from the heart and soul study. PLoS ONE, 11(10), 1–12. https://doi.org/10.1371/journal.pone.0160748
Gomes, N. M. V, Ryder, O. a., Houck, M. L., Charter, S. J., Walker, W., Forsyth, N. R., … Wright, W. E. (2011). Comparative biology of mammalian telomeres: Hypotheses on ancestral states and the roles of telomeres in longevity determination. Aging Cell, 10(5), 761–768. https://doi.org/10.1111/j.1474-9726.2011.00718.x
Harley, C., Futcher, A., & Greider, C. (1990). Telomeres shorten during ageing of human fibroblasts. Nature, 345(6274), 458–460. https://doi.org/10.1038/345458a0
Harrington, L., & Pucci, F. (2018). In medio stat virtus: unanticipated consequences of telomere dysequilibrium. Philosophical Transactions of the Royal Society B: Biological Sciences, 373(1741), 20160444. https://doi.org/10.1098/rstb.2016.0444
Haussmann, M. F., Longenecker, a. S., Marchetto, N. M., Juliano, S. a., & Bowden, R. M. (2012). Embryonic exposure to corticosterone modifies the juvenile stress response, oxidative stress and telomere length. Proceedings of the Royal Society B: Biological Sciences, 279(1732), 1447–1456. https://doi.org/10.1098/rspb.2011.1913
Haussmann, Mark F, Winkler, D. W., & Vleck, C. M. (2005). Longer telomeres associated with higher survival in birds. Biology Letters, 1(2), 212–214. https://doi.org/10.1098/rsbl.2005.0301
Heidinger, B. J., Blount, J. D., Boner, W., Griffiths, K., Metcalfe, N. B., & Monaghan, P. (2012). Telomere length in early life predicts lifespan. Proceedings of the National Academy of Sciences, 109(5), 1743–1748. https://doi.org/10.1073/pnas.1113306109
Huzen, J., Wong, L. S. M., van Veldhuisen, D. J., Samani, N. J., Zwinderman, A. H., Codd, V., … Van der Harst, P. (2014). Telomere length loss due to smoking and metabolic traits. Journal of Internal Medicine, 275(2), 155–163. https://doi.org/10.1111/joim.12149
Kark, J., Goldberger, N., Kimura, M., Sinnreich, R., & Aviv, A. (2012). Energy intake and leukocyte telomere length in young adults. The American Journal of Clinical Nutrition, (95), 479–487. https://doi.org/10.3945/ajcn.111.024521.1
Kim, S., Parks, C. G., DeRoo, L. A., Chen, H., Taylor, J. A., Cawthon, R. M., & Sandler, D. P. (2009). Obesity and weight gain in adulthood and telomere length. Cancer Epidemiology Biomarkers and Prevention, 18(3), 816–820. https://doi.org/10.1158/1055-9965.EPI-08-0935
Lai, T.-P., Zhang, N., Noh, J., Mender, I., Tedone, E., Huang, E., … Shay, J. W. (2017). A method for measuring the distribution of the shortest telomeres in cells and tissues. Nature Communications, 8(1), 1356. https://doi.org/10.1038/s41467-017-01291-z
Muñoz-lorente, M. A., Cano-martin, A. C., & Blasco, M. A. (2019). Mice with hyper-long telomeres show less metabolic aging and longer lifespans. Nature Communications, 10(4723), 1–14. https://doi.org/10.1038/s41467-019-12664-x
Nettle, D., Andrews, C., Reichert, S., Bedford, T., Kolenda, C., Parker, C., … Bateson, M. (2017). Early-life adversity accelerates cellular ageing and affects adult inflammation: Experimental evidence from the European starling. Scientific Reports, 7: 40794(December 2016), 1–10. https://doi.org/10.1038/srep40794
Nettle, D., Monaghan, P., Boner, W., Gillespie, R., & Bateson, M. (2013). Bottom of the heap: Having heavier competitors accelerates early-life telomere loss in the European starling, Sturnus vulgaris. PLoS ONE, 8(12). https://doi.org/10.1371/journal.pone.0083617
Nettle, D., Seeker, L., Nussey, D., Froy, H., & Bateson, M. (2019). Consequences of measurement error in qPCR telomere data: A simulation study. PLOS ONE, 14(5), e0216118. https://doi.org/10.1371/journal.pone.0216118
Nordfjäll, K., Svenson, U., Norrback, K. F., Adolfsson, R., Lenner, P., & Roos, G. (2009). The individual blood cell telomere attrition rate is telomere length dependent. PLoS Genetics, 5(2), 2–7. https://doi.org/10.1371/journal.pgen.1000375
Olovnikov, A. M. (1973). A theory of marginotomy. The incomplete copying of template margin in enzymic synthesis of polynucleotides and biological significance of the phenomenon. Journal of Theoretical Biology, 41(1), 181–190. https://doi.org/10.1016/0022-5193(73)90198-7
R Core Team. (2014). R: A Language and Environment for Statistical Computing. Vienna, Austria: R Foundation for Statistical Computing. Retrieved from http://www.r-project.org/
Reichert, S., Stier, A., Zahn, S., Arrivé, M., Bize, P., Massemin, S., & Criscuolo, F. (2014). Increased brood size leads to persistent eroded telomeres. Frontiers in Ecology and Evolution, 2(April), 1–11. https://doi.org/10.3389/fevo.2014.00009
Seeker, L. A., Holland, R., Underwood, S., Fairlie, J., Psifidi, A., Ilska, J., … Nussey, D. H. (2016). Method specific calibration corrects for DNA extraction method effects on relative telomere length measurements by quantitative PCR. PLoS ONE, 11(10), 1–15. https://doi.org/10.1371/journal.pone.0164046
Seeker, L. A., Ilska, J., Psifidi, A., Wilbourn, R. V., Underwood, S. L., Fairlie, J., … Banos, G. (2018). Bovine telomere dynamics and the association between telomere length and productive lifespan. Scientific Reports.
Seeker, L. A., Ilska, J., Psifidi, A., Wilbourn, R. V, Underwood, L., Fairlie, J., … Banos, G. (2018). Longitudinal changes in telomere length and associated genetic parameters in dairy cattle analysed using random regression models. Plos One, 1–15. https://doi.org/10.1371/journal.pone.0192864
Seeker, L., Holland, B., Psifidi, A., Banos, B., & Nussey, D. (2015). A robust assay for the measurement of telomere length in dairy cattle. In BSAS annual conference (p. 066).
Shalev, I., Moffitt, T. E., Sugden, K., Williams, B., Houts, R. M., Danese, A., … Caspi, A. (2012). Exposure to violence during childhood is associated with telomere erosion from 5 to 10 years of age: a longitudinal study. Mol.Psychiatry, 18(5), 576–581. https://doi.org/10.1038/mp.2012.32
Spurgin, L. G., Bebbington, K., Fairfield, E. A., Hammers, M., Komdeur, J., Burke, T., … Richardson, D. S. (2018). Spatio-temporal variation in lifelong telomere dynamics in a long-term ecological study. Journal of Animal Ecology, 87(1), 187–198. https://doi.org/10.1111/1365-2656.12741
Steenstrup, T., Hjelmborg, J. V. B., Mortensen, L. H., Kimura, M., Christensen, K., & Aviv, A. (2013). Leukocyte telomere dynamics in the elderly. European Journal of Epidemiology, 28(2), 181–187. https://doi.org/10.1007/s10654-013-9780-4
Svenson, U., Nordfjäll, K., Baird, D., Roger, L., Osterman, P., Hellenius, M.-L., & Roos, G. (2011). Blood Cell Telomere Length Is a Dynamic Feature. PLOS ONE, 6(6), e21485. Retrieved from https://doi.org/10.1371/journal.pone.0021485
Therneau, T. M. (2015). A Package for Survival Analysis in S. Retrieved from https://cran.r-project.org/package=survival
Veerkamp, R. ., Simm, G., & Oldham, J. . (1994). Effects of interaction between genotype and feeding system on milk production, feed intake, efficiency and body tissue mobilization in dairy cows. Livestock Production Science, 39(3), 229–241. https://doi.org/10.1016/0301-6226(94)90202-X
Voillemot, M., Hine, K., Zahn, S., Criscuolo, F., Gustafsson, L., Doligez, B., & Bize, P. (2012). Effects of brood size manipulation and common origin on phenotype and telomere length in nestling collared flycatchers. BMC Ecology, 12(1), 17. https://doi.org/10.1186/1472-6785-12-17
Watson, J. D. (1972). Origin of concatemeric T7 DNA. Nature: New Biology, 239(94), 197–201. Retrieved from http://www.ncbi.nlm.nih.gov/pubmed/4507727
Whittemore, K., Vera, E., Martínez-nevado, E., Sanpera, C., & Blasco, M. A. (2019). Telomere shortening rate predicts species life span. Proceedings of the National Academy of Sciences, 116(30), 15122–15127. https://doi.org/10.1073/pnas.1902452116
Wickham, H. (2009). ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag New York. Retrieved from http://ggplot2.org
Wilbourn, R. V., Moatt, J. P., Froy, H., Walling, C. A., Nussey, D. H., & Boonekamp, J. J. (2018). The relationship between telomere length and mortality risk in non-model vertebrate systems: a meta-analysis. Phil. Trans. R. Soc. B, 373(1741), 20160447. https://doi.org/10.1098/RSTB.2016.0447
Yuan, X., Kronström, M., Hellenius, M. L., Cederholm, T., & Xu, D. (2018). Longitudinal changes in leukocyte telomere length and mortality in elderly Swedish men. Aging, 10(10), 3005–3016.
The complete dataset will be accessible after acceptance on GitHub.
library(ggplot2)
library(nlme)
library(lme4)
## Loading required package: Matrix
##
## Attaching package: 'lme4'
## The following object is masked from 'package:nlme':
##
## lmList
library(lmerTest)
##
## Attaching package: 'lmerTest'
## The following object is masked from 'package:lme4':
##
## lmer
## The following object is masked from 'package:stats':
##
## step
library(grid)
library(gridExtra)
library(mgcv) # for GAM
## This is mgcv 1.8-33. For overview type 'help("mgcv-package")'.
library(data.table)
library(stringr)
library(magrittr)
library(ggthemes)
library(plyr)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:plyr':
##
## arrange, count, desc, failwith, id, mutate, rename, summarise,
## summarize
## The following objects are masked from 'package:data.table':
##
## between, first, last
## The following object is masked from 'package:gridExtra':
##
## combine
## The following object is masked from 'package:nlme':
##
## collapse
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(survival)
library(survminer)
## Loading required package: ggpubr
## Registered S3 methods overwritten by 'car':
## method from
## influence.merMod lme4
## cooks.distance.influence.merMod lme4
## dfbeta.influence.merMod lme4
## dfbetas.influence.merMod lme4
##
## Attaching package: 'ggpubr'
## The following object is masked from 'package:plyr':
##
## mutate
library(ggsci)
#library(AICcmodavg)
# Make colour palette
mypal <- pal_npg("nrc", alpha = 0.7)(10)
mypal2 <-pal_tron("legacy", alpha = 0.7)(7)
mypal3<-pal_lancet("lanonc", alpha = 0.7)(9)
mypal4<-pal_simpsons(palette = c("springfield"), alpha = 0.7)(16)
mycoloursP<- c(mypal, mypal2, mypal3, mypal4)
data<- read.csv("/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/LongTelomereDataCattle.csv")
mean_year_change <- data.frame(mean_change_rate = tapply(as.numeric(paste(data$atrr_rate_per_year)),
data$recoded_id, mean, na.rm = TRUE))
## Warning in tapply(as.numeric(paste(data$atrr_rate_per_year)), data$recoded_id, :
## NAs introduced by coercion
mean_year_change$recoded_id <- rownames(mean_year_change)
data <- merge(data, mean_year_change, by = "recoded_id")
ggplot(data, aes(x = as.numeric(paste(residual_rltl_tminus1)),
y = mean_change_rate,
colour = AgeGroup)) +
geom_point(size = 0.2)+
scale_color_manual(values=mycoloursP[16:40]) +
theme_classic() +
geom_abline(intercept = 0, slope = 0, colour = "red") +
stat_smooth(method = lm, formula = y ~ x) +
ylab("Mean yearly rate in RLTL change")+
xlab("Baseline RLTL")
## Warning in FUN(X[[i]], ...): NAs introduced by coercion
## Warning in FUN(X[[i]], ...): NAs introduced by coercion
## Warning in FUN(X[[i]], ...): NAs introduced by coercion
## Warning: Removed 305 rows containing non-finite values (stat_smooth).
## Warning: Removed 305 rows containing missing values (geom_point).
cor.test(as.numeric(paste(data$residual_rltl_tminus1)), data$mean_change_rate)
## Warning in cor.test(as.numeric(paste(data$residual_rltl_tminus1)),
## data$mean_change_rate): NAs introduced by coercion
##
## Pearson's product-moment correlation
##
## data: as.numeric(paste(data$residual_rltl_tminus1)) and data$mean_change_rate
## t = -2.2644, df = 1018, p-value = 0.02376
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.131603730 -0.009452614
## sample estimates:
## cor
## -0.07079357
Weather data was downloaded from the metoffice homepage from the station in Eskdalemuir which is the closest accessible weather data station to Dumfries (21.8 miles or 35.1 km based on freemaptools
Text data was importet to Excel, where season and year summary statistics were added. Then the data was exported as .csv file.
“sample_year” in the weather data was coded so that it included the first three month of the calendar year in which samples were taken plus the last nine month of the previous calendar year. So the most recent data was collected in the first quartal (Q1) while Q4, Q3, Q2 go back in time in that order. This is done in this way, because samples are usually taken in March and therefore it makes most sense that a sampling year goes from April to March.
weather<-read.csv("/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/weatherData/eskdalemuirdata_red_sampleYear.csv")
data<-merge(data, weather, by = "sample_year" )
To keep this document cleaner “createInputData.Rmd” was used to create different input dataframes in the format required for different analyses (for example a Cox- proportional hazard model needs different infromation to a linear mixed model).
# create data which only lists each animal ID once (needed for some counts/ histograms below)
uData<- data[!duplicated(data$recoded_id),]
# create data that excludes all first measurements without t-1 time point. This is used for investigations of change
redData<-subset(data, data$residual_rltl_tminus1 != "NULL")
init_change_dat<-read.csv("/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/first_year_long_tel_cattle.csv")
coxData<-read.csv("/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/cox_data.csv")
coxDataR<-subset(coxData, coxData$amp_305_lactation != "NULL")
deadD<-subset(data, data$herd_life != "NULL")
redDeadD<-subset(redData, redData$herd_life != "NULL")
uDeadData<-redDeadD[!duplicated(redDeadD$recoded_id),]
#Data for repeating Cox proportional hazard model without without the fist measurement.
red_data_l_new<-read.csv("/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/excluded_less_3_month.csv")
uniq_red_data_l_new<-red_data_l_new[!duplicated(red_data_l_new$recoded_id),]
#df with more than two measurements
more_2<-read.csv("/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/more_2_sampl.csv")
u_more_2<-more_2[!duplicated(more_2$recoded_id),]
cor.test(redData$residual_rltl_t, as.numeric(paste(redData$residual_rltl_tminus1)))
##
## Pearson's product-moment correlation
##
## data: redData$residual_rltl_t and as.numeric(paste(redData$residual_rltl_tminus1))
## t = 13.058, df = 1018, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.3249385 0.4301473
## sample estimates:
## cor
## 0.3787659
SubsPlot <- ggplot(redData, aes(x = as.numeric(paste(residual_rltl_tminus1)), y = redData$residual_rltl_t)) +
geom_point() +
xlab("RLTL at time t-1") +
ylab("RLTL at time t") +
theme_classic(20) +
geom_abline(intercept = 0, slope = 1, colour = "red") +
stat_smooth(method = lm, formula = y ~ x) #+ annotate("text", x = -0.4, y = 0.5, label = "(B)", fontface =2, size = 10)
agePlot <- ggplot(redData, aes(x = as.factor(redData$age_y), y = as.numeric(paste(redData$diff_rltl_res)), colour = as.factor(redData$age_y))) +
geom_jitter() +
theme_classic(20) +
xlab("Age in years") +
ylab("RLTL change") +
geom_boxplot() +
scale_color_manual(values = mycoloursP[16:40]) +
theme(legend.position = "none") #+ annotate("text", x = 1, y = 0.5, label = "(A)", fontface =2, size = 10)
grid.arrange(agePlot, SubsPlot, ncol = 2)
## Warning: Use of `redData$age_y` is discouraged. Use `age_y` instead.
## Warning: Use of `redData$diff_rltl_res` is discouraged. Use `diff_rltl_res`
## instead.
## Warning: Use of `redData$age_y` is discouraged. Use `age_y` instead.
## Warning: Use of `redData$age_y` is discouraged. Use `age_y` instead.
## Warning: Use of `redData$diff_rltl_res` is discouraged. Use `diff_rltl_res`
## instead.
## Warning: Use of `redData$age_y` is discouraged. Use `age_y` instead.
## Warning: Use of `redData$residual_rltl_t` is discouraged. Use `residual_rltl_t`
## instead.
## Warning: Use of `redData$residual_rltl_t` is discouraged. Use `residual_rltl_t`
## instead.
cor.test(redData$residual_rltl_t, as.numeric(paste(redData$residual_rltl_tminus1)))
##
## Pearson's product-moment correlation
##
## data: redData$residual_rltl_t and as.numeric(paste(redData$residual_rltl_tminus1))
## t = 13.058, df = 1018, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.3249385 0.4301473
## sample estimates:
## cor
## 0.3787659
#pdf(file = "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/output/Fig1_AB.pdf", width = 10, height = 4)
#grid.arrange(agePlot, SubsPlot, ncol=2)
#dev.off()
## Call: survfit(formula = Surv(init_change_dat$TimeMeasure, init_change_dat$Event ==
## 1) ~ init_change_dat$ResDiff_3G)
##
## init_change_dat$ResDiff_3G=1
## time n.risk n.event survival std.err lower 95% CI upper 95% CI
## 330 97 1 0.9897 0.0103 0.9698 1.000
## 349 96 1 0.9794 0.0144 0.9515 1.000
## 476 95 1 0.9691 0.0176 0.9352 1.000
## 499 94 2 0.9485 0.0225 0.9055 0.993
## 535 92 1 0.9381 0.0245 0.8914 0.987
## 544 91 1 0.9278 0.0263 0.8777 0.981
## 658 90 1 0.9175 0.0279 0.8644 0.974
## 699 89 1 0.9072 0.0295 0.8513 0.967
## 724 88 1 0.8969 0.0309 0.8384 0.960
## 731 87 1 0.8866 0.0322 0.8257 0.952
## 742 86 1 0.8763 0.0334 0.8132 0.944
## 750 85 1 0.8660 0.0346 0.8008 0.936
## 759 84 1 0.8557 0.0357 0.7885 0.929
## 760 83 1 0.8454 0.0367 0.7764 0.920
## 803 82 1 0.8351 0.0377 0.7644 0.912
## 845 81 1 0.8247 0.0386 0.7524 0.904
## 888 80 1 0.8144 0.0395 0.7406 0.896
## 906 79 1 0.8041 0.0403 0.7289 0.887
## 923 78 1 0.7938 0.0411 0.7173 0.879
## 925 77 1 0.7835 0.0418 0.7057 0.870
## 944 76 1 0.7732 0.0425 0.6942 0.861
## 948 75 1 0.7629 0.0432 0.6828 0.852
## 958 74 1 0.7526 0.0438 0.6714 0.844
## 961 73 1 0.7423 0.0444 0.6601 0.835
## 1019 72 1 0.7320 0.0450 0.6489 0.826
## 1045 71 1 0.7216 0.0455 0.6377 0.817
## 1110 70 1 0.7113 0.0460 0.6266 0.807
## 1127 69 1 0.7010 0.0465 0.6156 0.798
## 1156 68 1 0.6907 0.0469 0.6046 0.789
## 1177 67 1 0.6804 0.0473 0.5937 0.780
## 1195 66 1 0.6701 0.0477 0.5828 0.771
## 1205 65 1 0.6598 0.0481 0.5719 0.761
## 1283 64 1 0.6495 0.0484 0.5611 0.752
## 1301 63 1 0.6392 0.0488 0.5504 0.742
## 1345 62 1 0.6289 0.0491 0.5397 0.733
## 1364 61 1 0.6186 0.0493 0.5291 0.723
## 1371 60 1 0.6082 0.0496 0.5185 0.714
## 1384 59 1 0.5979 0.0498 0.5079 0.704
## 1417 58 1 0.5876 0.0500 0.4974 0.694
## 1436 57 1 0.5773 0.0502 0.4869 0.684
## 1483 56 1 0.5670 0.0503 0.4765 0.675
## 1567 55 1 0.5567 0.0504 0.4661 0.665
## 1575 54 1 0.5464 0.0505 0.4558 0.655
## 1588 53 1 0.5361 0.0506 0.4455 0.645
## 1608 52 1 0.5258 0.0507 0.4352 0.635
## 1615 51 1 0.5155 0.0507 0.4250 0.625
## 1661 50 1 0.5052 0.0508 0.4148 0.615
## 1715 49 1 0.4948 0.0508 0.4047 0.605
## 1739 48 1 0.4845 0.0507 0.3946 0.595
## 1756 47 1 0.4742 0.0507 0.3846 0.585
## 1758 46 1 0.4639 0.0506 0.3746 0.575
## 1762 45 1 0.4536 0.0505 0.3646 0.564
## 1766 44 2 0.4330 0.0503 0.3448 0.544
## 1786 42 1 0.4227 0.0502 0.3350 0.533
## 1822 41 1 0.4124 0.0500 0.3252 0.523
## 1855 40 1 0.4021 0.0498 0.3154 0.512
## 1937 39 1 0.3918 0.0496 0.3057 0.502
## 1940 38 1 0.3814 0.0493 0.2961 0.491
## 1942 37 1 0.3711 0.0491 0.2864 0.481
## 1977 36 1 0.3608 0.0488 0.2769 0.470
## 1999 35 1 0.3505 0.0484 0.2673 0.460
## 2001 34 1 0.3402 0.0481 0.2579 0.449
## 2018 33 1 0.3299 0.0477 0.2484 0.438
## 2035 30 1 0.3189 0.0474 0.2383 0.427
## 2041 29 1 0.3079 0.0470 0.2283 0.415
## 2060 28 1 0.2969 0.0466 0.2183 0.404
## 2067 27 2 0.2749 0.0457 0.1985 0.381
## 2072 25 1 0.2639 0.0452 0.1887 0.369
## 2075 24 1 0.2529 0.0446 0.1790 0.357
## 2086 23 1 0.2419 0.0440 0.1694 0.346
## 2113 20 1 0.2298 0.0434 0.1587 0.333
## 2166 17 1 0.2163 0.0429 0.1466 0.319
## 2185 16 1 0.2028 0.0423 0.1347 0.305
## 2191 15 1 0.1893 0.0416 0.1230 0.291
## 2235 13 1 0.1747 0.0409 0.1105 0.276
## 2264 12 1 0.1602 0.0400 0.0982 0.261
## 2285 10 1 0.1441 0.0390 0.0848 0.245
## 2325 8 1 0.1261 0.0381 0.0698 0.228
## 2457 7 1 0.1081 0.0367 0.0556 0.210
## 2583 4 1 0.0811 0.0361 0.0339 0.194
##
## init_change_dat$ResDiff_3G=2
## time n.risk n.event survival std.err lower 95% CI upper 95% CI
## 383 97 1 0.9897 0.0103 0.9698 1.000
## 501 96 1 0.9794 0.0144 0.9515 1.000
## 628 95 1 0.9691 0.0176 0.9352 1.000
## 636 94 1 0.9588 0.0202 0.9200 0.999
## 658 93 1 0.9485 0.0225 0.9055 0.993
## 749 92 1 0.9381 0.0245 0.8914 0.987
## 775 91 1 0.9278 0.0263 0.8777 0.981
## 805 90 1 0.9175 0.0279 0.8644 0.974
## 822 89 1 0.9072 0.0295 0.8513 0.967
## 830 88 1 0.8969 0.0309 0.8384 0.960
## 840 87 1 0.8866 0.0322 0.8257 0.952
## 867 86 1 0.8763 0.0334 0.8132 0.944
## 908 85 1 0.8660 0.0346 0.8008 0.936
## 909 84 1 0.8557 0.0357 0.7885 0.929
## 919 83 1 0.8454 0.0367 0.7764 0.920
## 923 82 1 0.8351 0.0377 0.7644 0.912
## 928 81 1 0.8247 0.0386 0.7524 0.904
## 982 80 1 0.8144 0.0395 0.7406 0.896
## 995 79 1 0.8041 0.0403 0.7289 0.887
## 1006 78 1 0.7938 0.0411 0.7173 0.879
## 1033 77 1 0.7835 0.0418 0.7057 0.870
## 1082 76 1 0.7732 0.0425 0.6942 0.861
## 1094 75 1 0.7629 0.0432 0.6828 0.852
## 1137 74 1 0.7526 0.0438 0.6714 0.844
## 1160 73 1 0.7423 0.0444 0.6601 0.835
## 1182 72 1 0.7320 0.0450 0.6489 0.826
## 1193 71 1 0.7216 0.0455 0.6377 0.817
## 1263 70 1 0.7113 0.0460 0.6266 0.807
## 1341 69 1 0.7010 0.0465 0.6156 0.798
## 1373 68 1 0.6907 0.0469 0.6046 0.789
## 1378 67 1 0.6804 0.0473 0.5937 0.780
## 1461 66 1 0.6701 0.0477 0.5828 0.771
## 1515 65 1 0.6598 0.0481 0.5719 0.761
## 1516 64 1 0.6495 0.0484 0.5611 0.752
## 1532 63 1 0.6392 0.0488 0.5504 0.742
## 1557 62 1 0.6289 0.0491 0.5397 0.733
## 1561 61 1 0.6186 0.0493 0.5291 0.723
## 1565 60 1 0.6082 0.0496 0.5185 0.714
## 1596 59 1 0.5979 0.0498 0.5079 0.704
## 1604 58 1 0.5876 0.0500 0.4974 0.694
## 1610 57 1 0.5773 0.0502 0.4869 0.684
## 1624 56 1 0.5670 0.0503 0.4765 0.675
## 1627 55 1 0.5567 0.0504 0.4661 0.665
## 1633 54 1 0.5464 0.0505 0.4558 0.655
## 1638 53 1 0.5361 0.0506 0.4455 0.645
## 1657 52 1 0.5258 0.0507 0.4352 0.635
## 1693 51 1 0.5155 0.0507 0.4250 0.625
## 1715 50 1 0.5052 0.0508 0.4148 0.615
## 1750 49 1 0.4948 0.0508 0.4047 0.605
## 1786 48 1 0.4845 0.0507 0.3946 0.595
## 1793 47 1 0.4742 0.0507 0.3846 0.585
## 1815 46 1 0.4639 0.0506 0.3746 0.575
## 1825 45 1 0.4536 0.0505 0.3646 0.564
## 1830 44 1 0.4433 0.0504 0.3547 0.554
## 1848 43 1 0.4330 0.0503 0.3448 0.544
## 1855 42 2 0.4124 0.0500 0.3252 0.523
## 1903 40 1 0.4021 0.0498 0.3154 0.512
## 1904 39 1 0.3918 0.0496 0.3057 0.502
## 1927 38 1 0.3814 0.0493 0.2961 0.491
## 1960 37 1 0.3711 0.0491 0.2864 0.481
## 1992 35 1 0.3605 0.0488 0.2765 0.470
## 2015 32 1 0.3493 0.0485 0.2660 0.459
## 2045 31 1 0.3380 0.0483 0.2555 0.447
## 2079 29 1 0.3263 0.0480 0.2446 0.435
## 2192 24 1 0.3127 0.0479 0.2317 0.422
## 2275 21 2 0.2830 0.0477 0.2033 0.394
## 2375 15 1 0.2641 0.0481 0.1848 0.377
## 2452 11 1 0.2401 0.0494 0.1604 0.359
## 2486 9 1 0.2134 0.0506 0.1341 0.340
## 2623 7 1 0.1829 0.0517 0.1051 0.318
## 2766 4 1 0.1372 0.0554 0.0621 0.303
## 2767 3 1 0.0915 0.0525 0.0297 0.282
##
## init_change_dat$ResDiff_3G=3
## time n.risk n.event survival std.err lower 95% CI upper 95% CI
## 302 97 1 0.990 0.0103 0.9698 1.000
## 495 96 1 0.979 0.0144 0.9515 1.000
## 641 95 1 0.969 0.0176 0.9352 1.000
## 648 94 1 0.959 0.0202 0.9200 0.999
## 721 93 1 0.948 0.0225 0.9055 0.993
## 727 92 1 0.938 0.0245 0.8914 0.987
## 735 91 1 0.928 0.0263 0.8777 0.981
## 798 90 1 0.918 0.0279 0.8644 0.974
## 833 89 1 0.907 0.0295 0.8513 0.967
## 895 88 1 0.897 0.0309 0.8384 0.960
## 897 87 1 0.887 0.0322 0.8257 0.952
## 904 86 1 0.876 0.0334 0.8132 0.944
## 930 85 1 0.866 0.0346 0.8008 0.936
## 982 84 1 0.856 0.0357 0.7885 0.929
## 1069 83 1 0.845 0.0367 0.7764 0.920
## 1128 82 1 0.835 0.0377 0.7644 0.912
## 1138 81 1 0.825 0.0386 0.7524 0.904
## 1142 80 1 0.814 0.0395 0.7406 0.896
## 1147 79 1 0.804 0.0403 0.7289 0.887
## 1158 78 2 0.784 0.0418 0.7057 0.870
## 1186 76 1 0.773 0.0425 0.6942 0.861
## 1209 75 1 0.763 0.0432 0.6828 0.852
## 1222 74 1 0.753 0.0438 0.6714 0.844
## 1280 73 1 0.742 0.0444 0.6601 0.835
## 1356 72 1 0.732 0.0450 0.6489 0.826
## 1381 71 1 0.722 0.0455 0.6377 0.817
## 1429 70 1 0.711 0.0460 0.6266 0.807
## 1468 69 1 0.701 0.0465 0.6156 0.798
## 1479 68 1 0.691 0.0469 0.6046 0.789
## 1551 67 1 0.680 0.0473 0.5937 0.780
## 1573 66 1 0.670 0.0477 0.5828 0.771
## 1593 65 1 0.660 0.0481 0.5719 0.761
## 1597 64 1 0.649 0.0484 0.5611 0.752
## 1609 63 1 0.639 0.0488 0.5504 0.742
## 1612 62 2 0.619 0.0493 0.5291 0.723
## 1633 60 2 0.598 0.0498 0.5079 0.704
## 1671 57 1 0.587 0.0500 0.4972 0.694
## 1701 56 1 0.577 0.0502 0.4865 0.684
## 1776 55 1 0.566 0.0504 0.4759 0.674
## 1785 54 1 0.556 0.0505 0.4653 0.664
## 1790 53 1 0.545 0.0506 0.4547 0.654
## 1834 52 1 0.535 0.0507 0.4442 0.644
## 1902 51 1 0.525 0.0508 0.4338 0.634
## 1904 50 1 0.514 0.0509 0.4234 0.624
## 1914 49 1 0.504 0.0509 0.4130 0.614
## 1975 47 1 0.493 0.0509 0.4024 0.603
## 1978 46 1 0.482 0.0509 0.3919 0.593
## 2017 44 1 0.471 0.0510 0.3812 0.582
## 2060 42 1 0.460 0.0510 0.3701 0.571
## 2063 41 1 0.449 0.0509 0.3592 0.561
## 2077 40 1 0.437 0.0509 0.3483 0.550
## 2090 39 1 0.426 0.0508 0.3375 0.538
## 2140 35 1 0.414 0.0508 0.3256 0.527
## 2146 33 1 0.402 0.0508 0.3134 0.514
## 2155 31 1 0.389 0.0508 0.3008 0.502
## 2171 30 1 0.376 0.0507 0.2883 0.489
## 2177 29 1 0.363 0.0506 0.2760 0.477
## 2333 24 1 0.348 0.0507 0.2612 0.463
## 2437 16 1 0.326 0.0520 0.2384 0.445
## 2476 15 1 0.304 0.0528 0.2164 0.428
## 2510 14 1 0.282 0.0533 0.1950 0.409
## 2541 12 1 0.259 0.0538 0.1722 0.389
## 2567 10 1 0.233 0.0543 0.1475 0.368
## 2579 9 1 0.207 0.0541 0.1241 0.346
## 2627 7 1 0.178 0.0539 0.0979 0.322
## 2822 5 1 0.142 0.0535 0.0678 0.297
## 2823 4 1 0.107 0.0506 0.0420 0.270
coxFit_calf <- coxph(Surv(init_change_dat$TimeMeasure,
init_change_dat$Event == 1)~init_change_dat$ResDiff_3G)
init_ch_plot<-ggsurvplot(cox_fit_init, data = init_change_dat,
surv.median.line = "hv", # Add medians survival
# Change legends: title & labels
legend.title = "Change",
legend.labs = c("Ter 1", "Ter 2", "Ter 3"),
# Add p-value and tervals
pval = TRUE,
conf.int = FALSE,
# Add risk table
risk.table = FALSE,
tables.height = 0.2,
tables.theme = theme_cleantable(),
# Color palettes. Use custom color: c("#E7B800", "#2E9FDF"),
# or brewer color (e.g.: "Dark2"), or ggsci color (e.g.: "jco")
palette = mycoloursP[16:40],
ggtheme = theme_classic()
) + xlab("Time in days")
coxFit_meanRLTL_3G<-coxph(Surv(coxData$TimeMeasure, coxData$Event == 1)~coxData$average_resid_3G)
summary(coxFit_meanRLTL_3G)
## Call:
## coxph(formula = Surv(coxData$TimeMeasure, coxData$Event == 1) ~
## coxData$average_resid_3G)
##
## n= 305, number of events= 241
##
## coef exp(coef) se(coef) z Pr(>|z|)
## coxData$average_resid_3G 0.01410 1.01420 0.07886 0.179 0.858
##
## exp(coef) exp(-coef) lower .95 upper .95
## coxData$average_resid_3G 1.014 0.986 0.869 1.184
##
## Concordance= 0.501 (se = 0.02 )
## Likelihood ratio test= 0.03 on 1 df, p=0.9
## Wald test = 0.03 on 1 df, p=0.9
## Score (logrank) test = 0.03 on 1 df, p=0.9
coxFit <- survfit(Surv(coxData$TimeMeasure, coxData$Event == 1)
~ coxData$average_resid_3G)
meanRLTL<-ggsurvplot(coxFit, data = coxData,
surv.median.line = "hv", # Add medians survival
# Change legends: title & labels
legend.title = "Length",
legend.labs = c("Ter 1", "Ter 2", "Ter 3"),
# Add p-value and tervals
pval = TRUE,
conf.int = FALSE,
# Add risk table
risk.table = FALSE,
tables.height = 0.2,
tables.theme = theme_cleantable(),
# Color palettes. Use custom color: c("#E7B800", "#2E9FDF"),
# or brewer color (e.g.: "Dark2"), or ggsci color (e.g.: "jco")
palette = mycoloursP[5:40],
ggtheme = theme_classic()
) + xlab("Time in days")
coxFit<-survfit(Surv(coxData$TimeMeasure, coxData$Event == 1) ~
coxData$rltl_change_3G)
coxFit_meanRLTL_CH_3G<-coxph(Surv(coxData$TimeMeasure, coxData$Event == 1)~coxData$rltl_change_3G)
summary(coxFit_meanRLTL_CH_3G)
## Call:
## coxph(formula = Surv(coxData$TimeMeasure, coxData$Event == 1) ~
## coxData$rltl_change_3G)
##
## n= 305, number of events= 241
##
## coef exp(coef) se(coef) z Pr(>|z|)
## coxData$rltl_change_3G -0.25745 0.77302 0.08656 -2.974 0.00294 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## coxData$rltl_change_3G 0.773 1.294 0.6524 0.9159
##
## Concordance= 0.56 (se = 0.019 )
## Likelihood ratio test= 8.88 on 1 df, p=0.003
## Wald test = 8.85 on 1 df, p=0.003
## Score (logrank) test = 8.92 on 1 df, p=0.003
mean_rltl_change<-ggsurvplot(coxFit, data = coxData,
surv.median.line = "hv", # Add medians survival
# Change legends: title & labels
legend.title = "Change",
legend.labs = c("Ter 1", "Ter 2", "Ter 3"),
# Add p-value and tervals
pval = TRUE,
conf.int = FALSE,
# Add risk table
risk.table = FALSE,
tables.height = 0.2,
tables.theme = theme_cleantable(),
# Color palettes. Use custom color: c("#E7B800", "#2E9FDF"),
# or brewer color (e.g.: "Dark2"), or ggsci color (e.g.: "jco")
palette = mycoloursP[10:40],
ggtheme = theme_classic()
) + xlab("Time in days")
coxFit_meanRLTL_absCH_3G <- coxph(Surv(coxData$TimeMeasure,
coxData$Event == 1) ~ coxData$abs_rltl_change_3G)
summary(coxFit_meanRLTL_absCH_3G)
## Call:
## coxph(formula = Surv(coxData$TimeMeasure, coxData$Event == 1) ~
## coxData$abs_rltl_change_3G)
##
## n= 305, number of events= 241
##
## coef exp(coef) se(coef) z Pr(>|z|)
## coxData$abs_rltl_change_3G 0.17936 1.19645 0.08189 2.19 0.0285 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## coxData$abs_rltl_change_3G 1.196 0.8358 1.019 1.405
##
## Concordance= 0.542 (se = 0.02 )
## Likelihood ratio test= 4.8 on 1 df, p=0.03
## Wald test = 4.8 on 1 df, p=0.03
## Score (logrank) test = 4.82 on 1 df, p=0.03
coxFit<-survfit(Surv(coxData$TimeMeasure, coxData$Event == 1)~coxData$abs_rltl_change_3G)
mean_abs_rltl_change<-ggsurvplot(coxFit, data = coxData,
surv.median.line = "hv", # Add medians survival
# Change legends: title & labels
legend.title = "Abs change",
legend.labs = c("Ter 1", "Ter 2", "Ter 3"),
# Add p-value and tervals
pval = TRUE,
conf.int = FALSE,
# Add risk table
risk.table = FALSE,
tables.height = 0.2,
tables.theme = theme_cleantable(),
# Color palettes. Use custom color: c("#E7B800", "#2E9FDF"),
# or brewer color (e.g.: "Dark2"), or ggsci color (e.g.: "jco")
palette = mycoloursP[35:40],
ggtheme = theme_classic()
) + xlab("Time in days")
surv_plotlist<-list()
surv_plotlist[[1]] <- init_ch_plot
surv_plotlist[[2]] <- mean_abs_rltl_change
surv_plotlist[[3]] <- meanRLTL
surv_plotlist[[4]] <- mean_rltl_change
print(arrange_ggsurvplots(surv_plotlist, print = TRUE, ncol = 4, nrow = 2))
## [[1]]
## NULL
meanRLTL
diseased <- subset(data, data$cull_catgory != "Herd management" &
data$cull_catgory != "Accident")
diseased <- unique(diseased$recoded_id)
length(diseased)
## [1] 254
diseased_surv <- subset(coxData, coxData$recoded_id %in% diseased)
init_change_dat_restr <- subset(init_change_dat,
init_change_dat$recoded_id %in% diseased)
Reason for culling restricted to disease-related conditions
coxFit_calf_restr <- coxph(Surv(init_change_dat_restr$TimeMeasure,
init_change_dat_restr$Event == 1) ~ init_change_dat_restr$ResDiff_3G)
summary(coxFit_calf_restr)
## Call:
## coxph(formula = Surv(init_change_dat_restr$TimeMeasure, init_change_dat_restr$Event ==
## 1) ~ init_change_dat_restr$ResDiff_3G)
##
## n= 245, number of events= 181
##
## coef exp(coef) se(coef) z Pr(>|z|)
## init_change_dat_restr$ResDiff_3G -0.23157 0.79329 0.09136 -2.535 0.0113 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## init_change_dat_restr$ResDiff_3G 0.7933 1.261 0.6632 0.9488
##
## Concordance= 0.545 (se = 0.022 )
## Likelihood ratio test= 6.45 on 1 df, p=0.01
## Wald test = 6.42 on 1 df, p=0.01
## Score (logrank) test = 6.48 on 1 df, p=0.01
cox_fit_init_restr <- survfit(Surv(init_change_dat_restr$TimeMeasure,
init_change_dat_restr$Event == 1) ~ init_change_dat_restr$ResDiff_3G)
summary(cox_fit_init_restr)
## Call: survfit(formula = Surv(init_change_dat_restr$TimeMeasure, init_change_dat_restr$Event ==
## 1) ~ init_change_dat_restr$ResDiff_3G)
##
## init_change_dat_restr$ResDiff_3G=1
## time n.risk n.event survival std.err lower 95% CI upper 95% CI
## 330 82 1 0.9878 0.0121 0.9643 1.000
## 699 81 1 0.9756 0.0170 0.9428 1.000
## 724 80 1 0.9634 0.0207 0.9236 1.000
## 731 79 1 0.9512 0.0238 0.9057 0.999
## 742 78 1 0.9390 0.0264 0.8886 0.992
## 750 77 1 0.9268 0.0288 0.8721 0.985
## 759 76 1 0.9146 0.0309 0.8561 0.977
## 760 75 1 0.9024 0.0328 0.8404 0.969
## 888 74 1 0.8902 0.0345 0.8251 0.961
## 906 73 1 0.8780 0.0361 0.8100 0.952
## 923 72 1 0.8659 0.0376 0.7951 0.943
## 925 71 1 0.8537 0.0390 0.7805 0.934
## 944 70 1 0.8415 0.0403 0.7660 0.924
## 958 69 1 0.8293 0.0416 0.7517 0.915
## 961 68 1 0.8171 0.0427 0.7375 0.905
## 1019 67 1 0.8049 0.0438 0.7235 0.895
## 1045 66 1 0.7927 0.0448 0.7096 0.885
## 1110 65 1 0.7805 0.0457 0.6958 0.875
## 1127 64 1 0.7683 0.0466 0.6822 0.865
## 1156 63 1 0.7561 0.0474 0.6686 0.855
## 1177 62 1 0.7439 0.0482 0.6552 0.845
## 1205 61 1 0.7317 0.0489 0.6418 0.834
## 1283 60 1 0.7195 0.0496 0.6286 0.824
## 1301 59 1 0.7073 0.0502 0.6154 0.813
## 1345 58 1 0.6951 0.0508 0.6023 0.802
## 1364 57 1 0.6829 0.0514 0.5893 0.791
## 1371 56 1 0.6707 0.0519 0.5764 0.781
## 1384 55 1 0.6585 0.0524 0.5635 0.770
## 1417 54 1 0.6463 0.0528 0.5507 0.759
## 1483 53 1 0.6341 0.0532 0.5380 0.747
## 1567 52 1 0.6220 0.0535 0.5254 0.736
## 1575 51 1 0.6098 0.0539 0.5128 0.725
## 1588 50 1 0.5976 0.0542 0.5003 0.714
## 1608 49 1 0.5854 0.0544 0.4879 0.702
## 1661 48 1 0.5732 0.0546 0.4755 0.691
## 1715 47 1 0.5610 0.0548 0.4632 0.679
## 1739 46 1 0.5488 0.0550 0.4510 0.668
## 1758 45 1 0.5366 0.0551 0.4388 0.656
## 1762 44 1 0.5244 0.0552 0.4267 0.644
## 1766 43 2 0.5000 0.0552 0.4027 0.621
## 1786 41 1 0.4878 0.0552 0.3908 0.609
## 1822 40 1 0.4756 0.0552 0.3789 0.597
## 1855 39 1 0.4634 0.0551 0.3671 0.585
## 1937 38 1 0.4512 0.0550 0.3554 0.573
## 1942 37 1 0.4390 0.0548 0.3437 0.561
## 1977 36 1 0.4268 0.0546 0.3321 0.549
## 1999 35 1 0.4146 0.0544 0.3206 0.536
## 2001 34 1 0.4024 0.0542 0.3091 0.524
## 2018 33 1 0.3902 0.0539 0.2977 0.511
## 2035 30 1 0.3772 0.0536 0.2855 0.498
## 2041 29 1 0.3642 0.0533 0.2734 0.485
## 2060 28 1 0.3512 0.0530 0.2613 0.472
## 2067 27 2 0.3252 0.0522 0.2375 0.445
## 2072 25 1 0.3122 0.0517 0.2257 0.432
## 2075 24 1 0.2992 0.0511 0.2140 0.418
## 2086 23 1 0.2862 0.0505 0.2025 0.405
## 2113 20 1 0.2719 0.0500 0.1896 0.390
## 2166 17 1 0.2559 0.0495 0.1751 0.374
## 2185 16 1 0.2399 0.0490 0.1608 0.358
## 2191 15 1 0.2239 0.0482 0.1468 0.342
## 2235 13 1 0.2067 0.0475 0.1317 0.324
## 2264 12 1 0.1894 0.0466 0.1170 0.307
## 2285 10 1 0.1705 0.0456 0.1010 0.288
## 2325 8 1 0.1492 0.0446 0.0830 0.268
## 2457 7 1 0.1279 0.0430 0.0661 0.247
## 2583 4 1 0.0959 0.0425 0.0402 0.229
##
## init_change_dat_restr$ResDiff_3G=2
## time n.risk n.event survival std.err lower 95% CI upper 95% CI
## 628 81 1 0.988 0.0123 0.9639 1.000
## 636 80 1 0.975 0.0172 0.9421 1.000
## 658 79 1 0.963 0.0210 0.9227 1.000
## 749 78 1 0.951 0.0241 0.9046 0.999
## 775 77 1 0.938 0.0267 0.8873 0.992
## 805 76 1 0.926 0.0291 0.8706 0.985
## 822 75 1 0.914 0.0312 0.8544 0.977
## 830 74 1 0.901 0.0331 0.8385 0.969
## 867 73 1 0.889 0.0349 0.8230 0.960
## 908 72 1 0.877 0.0366 0.8078 0.951
## 909 71 1 0.864 0.0381 0.7927 0.942
## 919 70 1 0.852 0.0395 0.7779 0.933
## 923 69 1 0.840 0.0408 0.7633 0.923
## 982 68 1 0.827 0.0420 0.7488 0.914
## 995 67 1 0.815 0.0432 0.7345 0.904
## 1082 66 1 0.802 0.0442 0.7203 0.894
## 1094 65 1 0.790 0.0452 0.7062 0.884
## 1137 64 1 0.778 0.0462 0.6923 0.874
## 1160 63 1 0.765 0.0471 0.6785 0.864
## 1193 62 1 0.753 0.0479 0.6648 0.853
## 1341 61 1 0.741 0.0487 0.6512 0.843
## 1373 60 1 0.728 0.0494 0.6377 0.832
## 1378 59 1 0.716 0.0501 0.6243 0.821
## 1461 58 1 0.704 0.0507 0.6110 0.811
## 1516 57 1 0.691 0.0513 0.5977 0.800
## 1532 56 1 0.679 0.0519 0.5846 0.789
## 1557 55 1 0.667 0.0524 0.5715 0.778
## 1561 54 1 0.654 0.0528 0.5585 0.767
## 1565 53 1 0.642 0.0533 0.5456 0.755
## 1596 52 1 0.630 0.0537 0.5328 0.744
## 1604 51 1 0.617 0.0540 0.5200 0.733
## 1610 50 1 0.605 0.0543 0.5073 0.721
## 1624 49 1 0.593 0.0546 0.4947 0.710
## 1627 48 1 0.580 0.0548 0.4821 0.698
## 1633 47 1 0.568 0.0550 0.4697 0.687
## 1657 46 1 0.556 0.0552 0.4572 0.675
## 1693 45 1 0.543 0.0553 0.4449 0.663
## 1715 44 1 0.531 0.0554 0.4326 0.651
## 1750 43 1 0.519 0.0555 0.4204 0.640
## 1793 42 1 0.506 0.0556 0.4082 0.628
## 1825 41 1 0.494 0.0556 0.3961 0.616
## 1830 40 1 0.481 0.0555 0.3841 0.604
## 1848 39 1 0.469 0.0554 0.3721 0.591
## 1855 38 2 0.444 0.0552 0.3484 0.567
## 1903 36 1 0.432 0.0550 0.3366 0.555
## 1904 35 1 0.420 0.0548 0.3249 0.542
## 1960 34 1 0.407 0.0546 0.3133 0.530
## 1992 32 1 0.395 0.0544 0.3013 0.517
## 2015 29 1 0.381 0.0542 0.2884 0.503
## 2045 28 1 0.367 0.0539 0.2756 0.490
## 2192 22 1 0.351 0.0540 0.2594 0.474
## 2275 19 2 0.314 0.0542 0.2237 0.440
## 2486 9 1 0.279 0.0584 0.1851 0.420
## 2623 7 1 0.239 0.0622 0.1437 0.398
## 2766 4 1 0.179 0.0697 0.0838 0.384
## 2767 3 1 0.120 0.0674 0.0396 0.361
##
## init_change_dat_restr$ResDiff_3G=3
## time n.risk n.event survival std.err lower 95% CI upper 95% CI
## 641 82 1 0.988 0.0121 0.9643 1.000
## 648 81 1 0.976 0.0170 0.9428 1.000
## 721 80 1 0.963 0.0207 0.9236 1.000
## 727 79 1 0.951 0.0238 0.9057 0.999
## 735 78 1 0.939 0.0264 0.8886 0.992
## 798 77 1 0.927 0.0288 0.8721 0.985
## 833 76 1 0.915 0.0309 0.8561 0.977
## 895 75 1 0.902 0.0328 0.8404 0.969
## 897 74 1 0.890 0.0345 0.8251 0.961
## 904 73 1 0.878 0.0361 0.8100 0.952
## 982 72 1 0.866 0.0376 0.7951 0.943
## 1128 71 1 0.854 0.0390 0.7805 0.934
## 1138 70 1 0.841 0.0403 0.7660 0.924
## 1142 69 1 0.829 0.0416 0.7517 0.915
## 1147 68 1 0.817 0.0427 0.7375 0.905
## 1158 67 1 0.805 0.0438 0.7235 0.895
## 1186 66 1 0.793 0.0448 0.7096 0.885
## 1222 65 1 0.780 0.0457 0.6958 0.875
## 1280 64 1 0.768 0.0466 0.6822 0.865
## 1356 63 1 0.756 0.0474 0.6686 0.855
## 1429 62 1 0.744 0.0482 0.6552 0.845
## 1468 61 1 0.732 0.0489 0.6418 0.834
## 1479 60 1 0.720 0.0496 0.6286 0.824
## 1573 59 1 0.707 0.0502 0.6154 0.813
## 1593 58 1 0.695 0.0508 0.6023 0.802
## 1597 57 1 0.683 0.0514 0.5893 0.791
## 1609 56 1 0.671 0.0519 0.5764 0.781
## 1612 55 1 0.659 0.0524 0.5635 0.770
## 1633 54 2 0.634 0.0532 0.5380 0.747
## 1671 51 1 0.622 0.0536 0.5251 0.736
## 1776 50 1 0.609 0.0539 0.5122 0.725
## 1785 49 1 0.597 0.0542 0.4995 0.713
## 1834 48 1 0.584 0.0545 0.4867 0.702
## 1902 47 1 0.572 0.0548 0.4741 0.690
## 1904 46 1 0.560 0.0550 0.4615 0.678
## 1978 44 1 0.547 0.0552 0.4487 0.666
## 2017 42 1 0.534 0.0554 0.4356 0.654
## 2060 40 1 0.520 0.0556 0.4222 0.642
## 2063 39 1 0.507 0.0557 0.4089 0.629
## 2077 38 1 0.494 0.0558 0.3956 0.616
## 2090 37 1 0.480 0.0559 0.3825 0.603
## 2140 33 1 0.466 0.0561 0.3680 0.590
## 2146 31 1 0.451 0.0562 0.3531 0.576
## 2177 29 1 0.435 0.0564 0.3377 0.561
## 2333 24 1 0.417 0.0569 0.3193 0.545
## 2437 16 1 0.391 0.0590 0.2910 0.526
## 2476 15 1 0.365 0.0606 0.2637 0.505
## 2510 14 1 0.339 0.0616 0.2374 0.484
## 2541 12 1 0.311 0.0626 0.2093 0.461
## 2567 10 1 0.280 0.0636 0.1791 0.437
## 2579 9 1 0.249 0.0637 0.1505 0.411
## 2627 7 1 0.213 0.0637 0.1186 0.383
## 2822 5 1 0.170 0.0636 0.0820 0.354
## 2823 4 1 0.128 0.0603 0.0507 0.322
init_ch_plot_restr<-ggsurvplot(cox_fit_init_restr, data = init_change_dat_restr,
surv.median.line = "hv", # Add medians survival
# Change legends: title & labels
legend.title = "Change",
legend.labs = c("Ter 1", "Ter 2", "Ter 3"),
# Add p-value and tervals
pval = TRUE,
conf.int = FALSE,
# Add risk table
risk.table = FALSE,
tables.height = 0.2,
tables.theme = theme_cleantable(),
# Color palettes. Use custom color: c("#E7B800", "#2E9FDF"),
# or brewer color (e.g.: "Dark2"), or ggsci color (e.g.: "jco")
palette = mycoloursP[16:40],
ggtheme = theme_classic()
) + xlab("Time in days")
# Then life-long average RLTL measures
Reason for culling restricted to disease-related conditions
coxFit <- survfit(Surv(diseased_surv$TimeMeasure,
diseased_surv$Event == 1)
~ diseased_surv$average_resid_3G)
coxFit_meanRLTL_3G_restr<-coxph(Surv(diseased_surv$TimeMeasure,
diseased_surv$Event == 1) ~
diseased_surv$average_resid_3G)
summary(coxFit_meanRLTL_3G_restr)
## Call:
## coxph(formula = Surv(diseased_surv$TimeMeasure, diseased_surv$Event ==
## 1) ~ diseased_surv$average_resid_3G)
##
## n= 254, number of events= 190
##
## coef exp(coef) se(coef) z Pr(>|z|)
## diseased_surv$average_resid_3G 0.005824 1.005841 0.087956 0.066 0.947
##
## exp(coef) exp(-coef) lower .95 upper .95
## diseased_surv$average_resid_3G 1.006 0.9942 0.8466 1.195
##
## Concordance= 0.503 (se = 0.023 )
## Likelihood ratio test= 0 on 1 df, p=0.9
## Wald test = 0 on 1 df, p=0.9
## Score (logrank) test = 0 on 1 df, p=0.9
meanRLTL_restr<-ggsurvplot(coxFit, data = diseased_surv,
surv.median.line = "hv", # Add medians survival
# Change legends: title & labels
legend.title = "Length",
legend.labs = c("Ter 1", "Ter 2", "Ter 3"),
# Add p-value and tervals
pval = TRUE,
conf.int = FALSE,
# Add risk table
risk.table = FALSE,
tables.height = 0.2,
tables.theme = theme_cleantable(),
# Color palettes. Use custom color: c("#E7B800", "#2E9FDF"),
# or brewer color (e.g.: "Dark2"), or ggsci color (e.g.: "jco")
palette = mycoloursP[5:40],
ggtheme = theme_classic()
) + xlab("Time in days")
Reason for culling restricted to disease-related conditions
coxFit<-survfit(Surv(diseased_surv$TimeMeasure,
diseased_surv$Event == 1) ~
diseased_surv$rltl_change_3G)
coxFit_meanRLTL_CH_3G_restr <-
coxph(Surv(diseased_surv$TimeMeasure,
diseased_surv$Event == 1) ~
diseased_surv$rltl_change_3G)
summary(coxFit_meanRLTL_CH_3G_restr)
## Call:
## coxph(formula = Surv(diseased_surv$TimeMeasure, diseased_surv$Event ==
## 1) ~ diseased_surv$rltl_change_3G)
##
## n= 254, number of events= 190
##
## coef exp(coef) se(coef) z Pr(>|z|)
## diseased_surv$rltl_change_3G -0.27437 0.76005 0.09912 -2.768 0.00564 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## diseased_surv$rltl_change_3G 0.7601 1.316 0.6259 0.923
##
## Concordance= 0.56 (se = 0.022 )
## Likelihood ratio test= 7.7 on 1 df, p=0.006
## Wald test = 7.66 on 1 df, p=0.006
## Score (logrank) test = 7.73 on 1 df, p=0.005
mean_rltl_change_restr <- ggsurvplot(coxFit, data = diseased_surv,
surv.median.line = "hv", # Add medians survival
# Change legends: title & labels
legend.title = "Change",
legend.labs = c("Ter 1", "Ter 2", "Ter 3"),
# Add p-value and tervals
pval = TRUE,
conf.int = FALSE,
# Add risk table
risk.table = FALSE,
tables.height = 0.2,
tables.theme = theme_cleantable(),
# Color palettes. Use custom color: c("#E7B800", "#2E9FDF"),
# or brewer color (e.g.: "Dark2"), or ggsci color (e.g.: "jco")
palette = mycoloursP[10:40],
ggtheme = theme_classic()
) + xlab("Time in days")
Reason for culling restricted to disease-related conditions
coxFit_meanRLTL_absCH_3G_restr <- coxph(Surv(diseased_surv$TimeMeasure,
diseased_surv$Event == 1) ~
diseased_surv$abs_rltl_change_3G)
summary(coxFit_meanRLTL_absCH_3G_restr)
## Call:
## coxph(formula = Surv(diseased_surv$TimeMeasure, diseased_surv$Event ==
## 1) ~ diseased_surv$abs_rltl_change_3G)
##
## n= 254, number of events= 190
##
## coef exp(coef) se(coef) z Pr(>|z|)
## diseased_surv$abs_rltl_change_3G 0.16161 1.17541 0.09192 1.758 0.0787 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## diseased_surv$abs_rltl_change_3G 1.175 0.8508 0.9816 1.407
##
## Concordance= 0.535 (se = 0.022 )
## Likelihood ratio test= 3.09 on 1 df, p=0.08
## Wald test = 3.09 on 1 df, p=0.08
## Score (logrank) test = 3.1 on 1 df, p=0.08
coxFit<-survfit(Surv(diseased_surv$TimeMeasure,
diseased_surv$Event == 1) ~
diseased_surv$abs_rltl_change_3G)
mean_abs_rltl_change_restr<-ggsurvplot(coxFit, data = diseased_surv,
surv.median.line = "hv", # Add medians survival
# Change legends: title & labels
legend.title = "Abs change",
legend.labs = c("Ter 1", "Ter 2", "Ter 3"),
# Add p-value and tervals
pval = TRUE,
conf.int = FALSE,
# Add risk table
risk.table = FALSE,
tables.height = 0.2,
tables.theme = theme_cleantable(),
# Color palettes. Use custom color: c("#E7B800", "#2E9FDF"),
# or brewer color (e.g.: "Dark2"), or ggsci color (e.g.: "jco")
palette = mycoloursP[35:40],
ggtheme = theme_classic()
) + xlab("Time in days")
init_ch_plot_restr
mean_abs_rltl_change_restr
meanRLTL_restr
mean_rltl_change_restr
RLTL measures were previously corrected for qPCR plate and row because they have a known effect on our measurements.
hist1 <- ggplot(uData, aes(x = uData$SamplesPerAnimal)) +
geom_histogram(colour = "black", fill = mycoloursP[7], binwidth = 1) +
xlab("Number of samples per animal") +
geom_vline(xintercept = mean(as.numeric(paste(uData$SamplesPerAnimal))), colour = "red") +
theme_classic(20) +
scale_x_continuous(breaks = c(1:8)) #+ annotate("text", x = 1, y = 100, label = "(A)", fontface =2, size = 8)
hist1
## Warning: Use of `uData$SamplesPerAnimal` is discouraged. Use `SamplesPerAnimal`
## instead.
hist2 <- ggplot(data, aes(x = data$residual_rltl_t)) +
geom_histogram(colour = "black", fill = mycoloursP[8]) +
xlab("Adjusted RLTL") +
geom_vline(xintercept = mean(as.numeric(paste(data$residual_rltl_t))), colour = "red") +
# annotate("text", x = -0.4, y = 120, label = "(B)", fontface =2, size = 8)+
theme_classic(20) +
stat_function(
fun = function(x, mean, sd, n) {
n / 25 * dnorm(x = x, mean = mean, sd = sd)
},
args = with(data, c(
mean = mean(data$residual_rltl_t), sd = sd(data$residual_rltl_t), n
= length(data$residual_rltl_t)
))
)
hist2
## Warning: Use of `data$residual_rltl_t` is discouraged. Use `residual_rltl_t`
## instead.
## Warning: Use of `data$residual_rltl_t` is discouraged. Use `residual_rltl_t`
## instead.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
nrow(redData)
## [1] 1020
diff <- as.numeric(paste(redData$diff_rltl_res))
hist3 <- ggplot(redData, aes(x = as.numeric(paste(redData$diff_rltl_res)))) +
geom_histogram(colour = "black", fill = mycoloursP[9]) +
xlab("Adjusted RLTL change") +
geom_vline(xintercept = mean(as.numeric(paste(redData$diff_rltl_res))), colour = "red") +
# annotate("text", x = -0.6, y = 95, label = "(C)", fontface =2, size= 8)+
theme_classic(20) +
stat_function(
fun = function(x, mean, sd, n) {
n / 23 * dnorm(x = x, mean = mean, sd = sd)
},
args = with(redData, c(
mean = mean(as.numeric(paste(redData$diff_rltl_res))), sd = sd(as.numeric(paste(redData$diff_rltl_res))), n
= length(as.numeric(paste(redData$diff_rltl_res)))
))
)
hist3
## Warning: Use of `redData$diff_rltl_res` is discouraged. Use `diff_rltl_res`
## instead.
## Warning: Use of `redData$diff_rltl_res` is discouraged. Use `diff_rltl_res`
## instead.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
grid.arrange(hist1, hist3, ncol = 2)
## Warning: Use of `uData$SamplesPerAnimal` is discouraged. Use `SamplesPerAnimal`
## instead.
## Warning: Use of `redData$diff_rltl_res` is discouraged. Use `diff_rltl_res`
## instead.
## Warning: Use of `redData$diff_rltl_res` is discouraged. Use `diff_rltl_res`
## instead.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
hist2
## Warning: Use of `data$residual_rltl_t` is discouraged. Use `residual_rltl_t`
## instead.
## Warning: Use of `data$residual_rltl_t` is discouraged. Use `residual_rltl_t`
## instead.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
init_hist <- ggplot(init_change_dat, aes(x = init_change_dat$ResDiff)) +
geom_histogram(colour = "black", fill = mycoloursP[10]) +
xlab("Initial RLTL change") +
theme_classic(20) +
geom_vline(xintercept = mean(as.numeric(paste(init_change_dat$ResDiff))), colour = "red") +
# annotate("text", x = -0.6, y = 28, label = "(D)", fontface =2, size= 8) +
stat_function(
fun = function(x, mean, sd, n) {
n / 23 * dnorm(x = x, mean = mean, sd = sd)
},
args = with(init_change_dat, c(
mean = mean(as.numeric(paste(init_change_dat$ResDiff))),
sd = sd(as.numeric(paste(init_change_dat$ResDiff))),
n = length(as.numeric(paste(init_change_dat$ResDiff)))
))
)
init_hist
## Warning: Use of `init_change_dat$ResDiff` is discouraged. Use `ResDiff` instead.
## Warning: Use of `init_change_dat$ResDiff` is discouraged. Use `ResDiff` instead.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
##### Histogram of RLTL at birth
init_rltl0_hist <- ggplot(init_change_dat, aes(x = init_change_dat$RLTL0)) +
geom_histogram(colour = "black", fill = mycoloursP[15]) +
xlab("RLTL at birth") +
theme_classic(20) +
geom_vline(xintercept = mean(as.numeric(paste(init_change_dat$RLTL0))), colour = "red") +
# annotate("text", x = -0.6, y = 28, label = "(D)", fontface =2, size= 8) +
stat_function(
fun = function(x, mean, sd, n) {
n / 23 * dnorm(x = x, mean = mean, sd = sd)
},
args = with(init_change_dat, c(
mean = mean(as.numeric(paste(init_change_dat$RLTL0))),
sd = sd(as.numeric(paste(init_change_dat$RLTL0))),
n = length(as.numeric(paste(init_change_dat$RLTL0)))
))
)
init_rltl0_hist
## Warning: Use of `init_change_dat$RLTL0` is discouraged. Use `RLTL0` instead.
## Warning: Use of `init_change_dat$RLTL0` is discouraged. Use `RLTL0` instead.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
init_rltl1_hist <- ggplot(init_change_dat, aes(x = init_change_dat$RLTL1)) +
geom_histogram(colour = "black", fill = mycoloursP[16]) +
xlab("RLTL at one year") +
theme_classic(20) +
geom_vline(xintercept = mean(as.numeric(paste(init_change_dat$RLTL1))), colour = "red") +
# annotate("text", x = -0.6, y = 28, label = "(D)", fontface =2, size= 8) +
stat_function(
fun = function(x, mean, sd, n) {
n / 23 * dnorm(x = x, mean = mean, sd = sd)
},
args = with(init_change_dat, c(
mean = mean(as.numeric(paste(init_change_dat$RLTL1))),
sd = sd(as.numeric(paste(init_change_dat$RLTL1))),
n = length(as.numeric(paste(init_change_dat$RLTL1)))
))
)
init_rltl1_hist
## Warning: Use of `init_change_dat$RLTL1` is discouraged. Use `RLTL1` instead.
## Warning: Use of `init_change_dat$RLTL1` is discouraged. Use `RLTL1` instead.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
grid.arrange(init_rltl0_hist, init_rltl1_hist, init_hist, ncol = 3)
## Warning: Use of `init_change_dat$RLTL0` is discouraged. Use `RLTL0` instead.
## Warning: Use of `init_change_dat$RLTL0` is discouraged. Use `RLTL0` instead.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Use of `init_change_dat$RLTL1` is discouraged. Use `RLTL1` instead.
## Warning: Use of `init_change_dat$RLTL1` is discouraged. Use `RLTL1` instead.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Use of `init_change_dat$ResDiff` is discouraged. Use `ResDiff` instead.
## Warning: Use of `init_change_dat$ResDiff` is discouraged. Use `ResDiff` instead.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
hist1b <- ggplot(u_more_2, aes(x = SamplesPerAnimal)) +
geom_histogram(colour = "black", fill = mycoloursP[11], binwidth = 1) +
xlab("Number of samples per animal") +
geom_vline(xintercept = mean(as.numeric(paste(u_more_2$SamplesPerAnimal)), na.rm = TRUE), colour = "red") +
annotate("text", x = 0.7, y = 100, label = "(E)", fontface = 2, size = 8) +
theme_classic(20) +
scale_x_continuous(breaks = c(1:8))
# hist1b
For dataframe with more than 2 samples
hist2b <- ggplot(more_2, aes(x = more_2$residual_rltl_t)) +
geom_histogram(colour = "black", fill = mycoloursP[12]) +
xlab("Adjusted RLTL") +
geom_vline(xintercept = mean(as.numeric(paste(more_2$residual_rltl_t))), colour = "red") +
annotate("text", x = -0.4, y = 95, label = "(F)", fontface = 2, size = 8) +
theme_classic(20) +
stat_function(
fun = function(x, mean, sd, n) {
n / 27 * dnorm(x = x, mean = mean, sd = sd)
},
args = with(more_2, c(
mean = mean(more_2$residual_rltl_t), sd = sd(more_2$residual_rltl_t), n
= length(more_2$residual_rltl_t)
))
)
# hist2b
nrow(more_2)
## [1] 992
hist3b <- ggplot(more_2, aes(x = as.numeric(paste(more_2$diff_rltl_res)))) +
geom_histogram(colour = "black", fill = mycoloursP[13]) +
xlab("Adjusted RLTL change") +
geom_vline(xintercept = mean(as.numeric(paste(more_2$diff_rltl_res))), colour = "red") +
annotate("text", x = -0.6, y = 95, label = "(G)", fontface = 2, size = 8) +
theme_classic(20) +
stat_function(
fun = function(x, mean, sd, n) {
n / 23 * dnorm(x = x, mean = mean, sd = sd)
},
args = with(more_2, c(
mean = mean(as.numeric(paste(more_2$diff_rltl_res))), sd = sd(as.numeric(paste(more_2$diff_rltl_res))), n
= length(as.numeric(paste(more_2$diff_rltl_res)))
))
)
# hist3b
variable <- as.numeric(paste(uDeadData$herd_life))
# sqrt might improve normality test outcome slightly...
meanHL <- mean(as.numeric(paste(uDeadData$herd_life)))
prod_lsp_plot <- ggplot(uDeadData, aes(x = as.numeric(paste(uDeadData$herd_life)))) +
geom_histogram(colour = "black", fill = mycoloursP[14]) +
xlab("Productive lifespan in days") +
geom_vline(xintercept = mean(as.numeric(paste(uDeadData$herd_life))), colour = "red") +
# annotate("text", x = 10, y = 19, label = "(H)", fontface =2, size= 8) +
theme_classic(20) +
stat_function(
fun = function(x, mean, sd, n) {
n * 120 * dnorm(x = x, mean = mean, sd = sd)
},
args = with(uDeadData, c(
mean = mean(as.numeric(paste(uDeadData$herd_life))),
sd = sd(as.numeric(paste(uDeadData$herd_life))),
n = length(as.numeric(paste(uDeadData$herd_life)))
))
)
prod_lsp_plot
## Warning: Use of `uDeadData$herd_life` is discouraged. Use `herd_life` instead.
## Warning: Use of `uDeadData$herd_life` is discouraged. Use `herd_life` instead.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
#pdf(file = "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/FigS1.pdf", width = 20, height = 15)
#grid.arrange(hist1, hist2, hist3, init_hist, hist1b, hist2b, hist3b, prod_lsp_plot, ncol = 4)
#dev.off()
grid.arrange(hist1, hist2, hist3, init_hist, hist1b, hist2b, hist3b, prod_lsp_plot, ncol = 4)
## Warning: Use of `uData$SamplesPerAnimal` is discouraged. Use `SamplesPerAnimal`
## instead.
## Warning: Use of `data$residual_rltl_t` is discouraged. Use `residual_rltl_t`
## instead.
## Warning: Use of `data$residual_rltl_t` is discouraged. Use `residual_rltl_t`
## instead.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Use of `redData$diff_rltl_res` is discouraged. Use `diff_rltl_res`
## instead.
## Warning: Use of `redData$diff_rltl_res` is discouraged. Use `diff_rltl_res`
## instead.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Use of `init_change_dat$ResDiff` is discouraged. Use `ResDiff` instead.
## Warning: Use of `init_change_dat$ResDiff` is discouraged. Use `ResDiff` instead.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Use of `more_2$residual_rltl_t` is discouraged. Use `residual_rltl_t`
## instead.
## Warning: Use of `more_2$residual_rltl_t` is discouraged. Use `residual_rltl_t`
## instead.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Use of `more_2$diff_rltl_res` is discouraged. Use `diff_rltl_res`
## instead.
## Warning: Use of `more_2$diff_rltl_res` is discouraged. Use `diff_rltl_res`
## instead.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Use of `uDeadData$herd_life` is discouraged. Use `herd_life` instead.
## Warning: Use of `uDeadData$herd_life` is discouraged. Use `herd_life` instead.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
RLTL length
# statistical tests for normal distribution of RTL measurements
shapiro.test(data$residual_rltl_t)
##
## Shapiro-Wilk normality test
##
## data: data$residual_rltl_t
## W = 0.989, p-value = 1.967e-08
ks.test(data$residual_rltl_t, pnorm)
##
## One-sample Kolmogorov-Smirnov test
##
## data: data$residual_rltl_t
## D = 0.36744, p-value < 2.2e-16
## alternative hypothesis: two-sided
qqnorm(data$residual_rltl_t)
Adjusted RLTL change
# statistical tests for normal distribution of RTL measurements
shapiro.test(as.numeric(paste(data$diff_rltl_res)))
## Warning in stopifnot(is.numeric(x)): NAs introduced by coercion
##
## Shapiro-Wilk normality test
##
## data: as.numeric(paste(data$diff_rltl_res))
## W = 0.998, p-value = 0.2655
ks.test(as.numeric(paste(data$diff_rltl_res)), pnorm)
## Warning in ks.test(as.numeric(paste(data$diff_rltl_res)), pnorm): NAs introduced
## by coercion
##
## One-sample Kolmogorov-Smirnov test
##
## data: as.numeric(paste(data$diff_rltl_res))
## D = 0.35414, p-value < 2.2e-16
## alternative hypothesis: two-sided
qqnorm(as.numeric(paste(data$diff_rltl_res)))
## Warning in qqnorm(as.numeric(paste(data$diff_rltl_res))): NAs introduced by
## coercion
# statistical tests for normal distribution of difference in RTL residuals
shapiro.test(as.numeric(paste(uDeadData$herd_life)))
##
## Shapiro-Wilk normality test
##
## data: as.numeric(paste(uDeadData$herd_life))
## W = 0.98408, p-value = 0.008487
ks.test(as.numeric(paste(uDeadData$herd_life)), pnorm)
## Warning in ks.test(as.numeric(paste(uDeadData$herd_life)), pnorm): ties should
## not be present for the Kolmogorov-Smirnov test
##
## One-sample Kolmogorov-Smirnov test
##
## data: as.numeric(paste(uDeadData$herd_life))
## D = 1, p-value < 2.2e-16
## alternative hypothesis: two-sided
qqnorm(as.numeric(paste(uDeadData$herd_life)))
# test if mean RLTL change is significantly different from zero:
t.test(as.numeric(paste(redData$diff_rltl_res)), mu=0, alternative="less", conf.level=0.99)
##
## One Sample t-test
##
## data: as.numeric(paste(redData$diff_rltl_res))
## t = -5.8438, df = 1019, p-value = 3.43e-09
## alternative hypothesis: true mean is less than 0
## 99 percent confidence interval:
## -Inf -0.01949685
## sample estimates:
## mean of x
## -0.03242526
count <- nrow(data)
unique_count <- length(unique(data$recoded_id))
sample_year_summ <- summary(as.factor(data$sample_year))
print(paste("There are ", count, " relative leukocyte telomere length (RLTL) measurements of ", unique_count, " animals included in the study.", sep = ""))
## [1] "There are 1325 relative leukocyte telomere length (RLTL) measurements of 305 animals included in the study."
sample_year_summ
## 2008 2009 2010 2011 2012 2013 2014
## 22 91 179 247 266 272 248
Due to our sample routine, animals samples in 2008 all must be calves. This may have an impact on an investigation of the effect of sample year on change in RLTL.
shortening <- subset(redData, as.numeric(paste(redData$diff_rltl_res)) < 0)
elongating <- subset(redData, as.numeric(paste(redData$diff_rltl_res)) > 0)
percent_shortening <- nrow(shortening) / nrow(redData) * 100
percent_shortening
## [1] 56.47059
percent_elongating <- nrow(elongating) / nrow(redData) * 100
percent_elongating
## [1] 43.52941
cor.test(init_change_dat$ResDiff, init_change_dat$sample_interval)
##
## Pearson's product-moment correlation
##
## data: init_change_dat$ResDiff and init_change_dat$sample_interval
## t = 0.13604, df = 289, p-value = 0.8919
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.1070775 0.1228704
## sample estimates:
## cor
## 0.008002275
ggplot(init_change_dat, aes(x = sample_interval, y = ResDiff)) +
geom_point()+
ylab("Change in RLTL")+
xlab("Sample Interval")+
theme_minimal()
In calves as well as in adults, the sample interval does not correlate with change in RLTL suggesting that changing rate differs.
# There is only one second time point in the year 2009:
summary(as.factor(redData$sample_year))
## 2009 2010 2011 2012 2013 2014
## 1 88 178 238 269 246
nrow(redData)
## [1] 1020
# this sample is therefore removed:
redData <- subset(redData, redData$sample_year != 2009)
nrow(redData)
## [1] 1019
init_mod <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
redData$age_y +
redData$feed_group +
redData$genetic_group+ as.factor(redData$birth_year) +
as.factor(redData$sample_year) +
as.numeric(paste(redData$sample_interval))+
redData$health_event_2week +
(1|redData$recoded_id), na.action=na.exclude)
## boundary (singular) fit: see ?isSingular
summary(init_mod)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(redData$diff_rltl_res)) ~ redData$age_y + redData$feed_group +
## redData$genetic_group + as.factor(redData$birth_year) + as.factor(redData$sample_year) +
## as.numeric(paste(redData$sample_interval)) + redData$health_event_2week +
## (1 | redData$recoded_id)
##
## REML criterion at convergence: -599.3
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.4980 -0.6836 0.0252 0.6717 3.5498
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 0.00000 0.0000
## Residual 0.02953 0.1718
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -1.263e-01 3.879e-02 1.002e+03
## redData$age_y 2.219e-02 1.385e-02 1.002e+03
## redData$feed_group2 -8.381e-03 1.223e-02 1.002e+03
## redData$feed_groupNULL -6.651e-03 1.627e-02 1.002e+03
## redData$genetic_groupS -1.025e-02 1.144e-02 1.002e+03
## as.factor(redData$birth_year)2009 -1.431e-02 2.062e-02 1.002e+03
## as.factor(redData$birth_year)2010 -1.231e-02 2.855e-02 1.002e+03
## as.factor(redData$birth_year)2011 -6.343e-03 3.863e-02 1.002e+03
## as.factor(redData$birth_year)2012 -2.192e-02 5.533e-02 1.002e+03
## as.factor(redData$birth_year)2013 -1.466e-01 1.114e-01 1.002e+03
## as.factor(redData$birth_year)2014 -2.415e-01 1.925e-01 1.002e+03
## as.factor(redData$sample_year)2011 4.158e-02 2.644e-02 1.002e+03
## as.factor(redData$sample_year)2012 6.309e-02 3.329e-02 1.002e+03
## as.factor(redData$sample_year)2013 8.721e-02 4.463e-02 1.002e+03
## as.factor(redData$sample_year)2014 6.360e-02 6.047e-02 1.002e+03
## as.numeric(paste(redData$sample_interval)) -2.685e-06 5.434e-05 1.002e+03
## redData$health_event_2week 1.764e-02 2.447e-02 1.002e+03
## t value Pr(>|t|)
## (Intercept) -3.256 0.00117 **
## redData$age_y 1.602 0.10952
## redData$feed_group2 -0.685 0.49328
## redData$feed_groupNULL -0.409 0.68275
## redData$genetic_groupS -0.896 0.37059
## as.factor(redData$birth_year)2009 -0.694 0.48796
## as.factor(redData$birth_year)2010 -0.431 0.66631
## as.factor(redData$birth_year)2011 -0.164 0.86961
## as.factor(redData$birth_year)2012 -0.396 0.69205
## as.factor(redData$birth_year)2013 -1.316 0.18862
## as.factor(redData$birth_year)2014 -1.255 0.20990
## as.factor(redData$sample_year)2011 1.573 0.11605
## as.factor(redData$sample_year)2012 1.895 0.05835 .
## as.factor(redData$sample_year)2013 1.954 0.05097 .
## as.factor(redData$sample_year)2014 1.052 0.29309
## as.numeric(paste(redData$sample_interval)) -0.049 0.96060
## redData$health_event_2week 0.721 0.47107
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation matrix not shown by default, as p = 17 > 12.
## Use print(x, correlation=TRUE) or
## vcov(x) if you need it
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(init_mod)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF
## redData$age_y 0.075762 0.075762 1 1002
## redData$feed_group 0.014654 0.007327 2 1002
## redData$genetic_group 0.023694 0.023694 1 1002
## as.factor(redData$birth_year) 0.128774 0.021462 6 1002
## as.factor(redData$sample_year) 0.312340 0.078085 4 1002
## as.numeric(paste(redData$sample_interval)) 0.000072 0.000072 1 1002
## redData$health_event_2week 0.015351 0.015351 1 1002
## F value Pr(>F)
## redData$age_y 2.5657 0.10952
## redData$feed_group 0.2481 0.78031
## redData$genetic_group 0.8024 0.37059
## as.factor(redData$birth_year) 0.7268 0.62806
## as.factor(redData$sample_year) 2.6443 0.03235 *
## as.numeric(paste(redData$sample_interval)) 0.0024 0.96060
## redData$health_event_2week 0.5199 0.47107
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(init_mod)
## [1] -561.2719
# There is a warning that this model is singular which is due to the random effect variance structure. It means that the variance due to the animal ID is not significantly different from 0. Although this may be a problem for some models, I think in this case it is not. It simply means that there is no variation between animals in the RLTL change and that is to be expected here, because the variance within animals is much larger than the variance between animals.
# Sample year is statistically significant, but it might only be signifgicant due to the design of our study. Becasue we wanted to have repeat measurements for all animals with the first measurement taken with the first 15 days of life, sampling in the first year only included calves which have been shown before to have longer telomeres than adults and to shorten them in their first year of life. So is the year effect simply driven by that? If so, it should vanish after excluding samples taken within the two years
init_mod_out <- as.data.frame(VarCorr(init_mod),comp = c("Variance", "Std.Dev."))
repET <- init_mod_out[1,4]/sum(init_mod_out[1:nrow(init_mod_out),4])
repET
## [1] 0
summary(as.factor(data$sample_year))
## 2008 2009 2010 2011 2012 2013 2014
## 22 91 179 247 266 272 248
test_dat<-subset(data, data$sample_year != 2008)
test_dat<-subset(test_dat, test_dat$sample_year != 2009)
long_dat <- subset(test_dat, test_dat$diff_rltl_res != "NULL")
late_mod <- lmer(as.numeric(paste(long_dat$diff_rltl_res)) ~
long_dat$age_y +
long_dat$feed_group +
long_dat$genetic_group +
as.factor(long_dat$birth_year) +
as.factor(long_dat$sample_year) +
as.numeric(paste(long_dat$sample_interval)) +
long_dat$health_event_2week +
(1|long_dat$recoded_id),
na.action=na.exclude)
## boundary (singular) fit: see ?isSingular
summary(late_mod)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: as.numeric(paste(long_dat$diff_rltl_res)) ~ long_dat$age_y +
## long_dat$feed_group + long_dat$genetic_group + as.factor(long_dat$birth_year) +
## as.factor(long_dat$sample_year) + as.numeric(paste(long_dat$sample_interval)) +
## long_dat$health_event_2week + (1 | long_dat$recoded_id)
##
## REML criterion at convergence: -599.3
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.4980 -0.6836 0.0252 0.6717 3.5498
##
## Random effects:
## Groups Name Variance Std.Dev.
## long_dat$recoded_id (Intercept) 0.00000 0.0000
## Residual 0.02953 0.1718
## Number of obs: 1019, groups: long_dat$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -1.263e-01 3.879e-02 1.002e+03
## long_dat$age_y 2.219e-02 1.385e-02 1.002e+03
## long_dat$feed_group2 -8.381e-03 1.223e-02 1.002e+03
## long_dat$feed_groupNULL -6.651e-03 1.627e-02 1.002e+03
## long_dat$genetic_groupS -1.025e-02 1.144e-02 1.002e+03
## as.factor(long_dat$birth_year)2009 -1.431e-02 2.062e-02 1.002e+03
## as.factor(long_dat$birth_year)2010 -1.231e-02 2.855e-02 1.002e+03
## as.factor(long_dat$birth_year)2011 -6.343e-03 3.863e-02 1.002e+03
## as.factor(long_dat$birth_year)2012 -2.192e-02 5.533e-02 1.002e+03
## as.factor(long_dat$birth_year)2013 -1.466e-01 1.114e-01 1.002e+03
## as.factor(long_dat$birth_year)2014 -2.415e-01 1.925e-01 1.002e+03
## as.factor(long_dat$sample_year)2011 4.158e-02 2.644e-02 1.002e+03
## as.factor(long_dat$sample_year)2012 6.309e-02 3.329e-02 1.002e+03
## as.factor(long_dat$sample_year)2013 8.721e-02 4.463e-02 1.002e+03
## as.factor(long_dat$sample_year)2014 6.360e-02 6.047e-02 1.002e+03
## as.numeric(paste(long_dat$sample_interval)) -2.685e-06 5.434e-05 1.002e+03
## long_dat$health_event_2week 1.764e-02 2.447e-02 1.002e+03
## t value Pr(>|t|)
## (Intercept) -3.256 0.00117 **
## long_dat$age_y 1.602 0.10952
## long_dat$feed_group2 -0.685 0.49328
## long_dat$feed_groupNULL -0.409 0.68275
## long_dat$genetic_groupS -0.896 0.37059
## as.factor(long_dat$birth_year)2009 -0.694 0.48796
## as.factor(long_dat$birth_year)2010 -0.431 0.66631
## as.factor(long_dat$birth_year)2011 -0.164 0.86961
## as.factor(long_dat$birth_year)2012 -0.396 0.69205
## as.factor(long_dat$birth_year)2013 -1.316 0.18862
## as.factor(long_dat$birth_year)2014 -1.255 0.20990
## as.factor(long_dat$sample_year)2011 1.573 0.11605
## as.factor(long_dat$sample_year)2012 1.895 0.05835 .
## as.factor(long_dat$sample_year)2013 1.954 0.05097 .
## as.factor(long_dat$sample_year)2014 1.052 0.29309
## as.numeric(paste(long_dat$sample_interval)) -0.049 0.96060
## long_dat$health_event_2week 0.721 0.47107
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation matrix not shown by default, as p = 17 > 12.
## Use print(x, correlation=TRUE) or
## vcov(x) if you need it
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(late_mod)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF
## long_dat$age_y 0.075762 0.075762 1 1002
## long_dat$feed_group 0.014654 0.007327 2 1002
## long_dat$genetic_group 0.023694 0.023694 1 1002
## as.factor(long_dat$birth_year) 0.128774 0.021462 6 1002
## as.factor(long_dat$sample_year) 0.312340 0.078085 4 1002
## as.numeric(paste(long_dat$sample_interval)) 0.000072 0.000072 1 1002
## long_dat$health_event_2week 0.015351 0.015351 1 1002
## F value Pr(>F)
## long_dat$age_y 2.5657 0.10952
## long_dat$feed_group 0.2481 0.78031
## long_dat$genetic_group 0.8024 0.37059
## as.factor(long_dat$birth_year) 0.7268 0.62806
## as.factor(long_dat$sample_year) 2.6443 0.03235 *
## as.numeric(paste(long_dat$sample_interval)) 0.0024 0.96060
## long_dat$health_event_2week 0.5199 0.47107
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(late_mod)
## [1] -561.2719
# sample year remains statistically significant.
red_mod <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
redData$age_y +
redData$feed_group +
redData$genetic_group+
as.factor(redData$sample_year) +
as.numeric(paste(redData$sample_interval)) +
(1|redData$recoded_id),
na.action=na.exclude)
## boundary (singular) fit: see ?isSingular
summary(red_mod)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(redData$diff_rltl_res)) ~ redData$age_y + redData$feed_group +
## redData$genetic_group + as.factor(redData$sample_year) +
## as.numeric(paste(redData$sample_interval)) + (1 | redData$recoded_id)
##
## REML criterion at convergence: -627.8
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.5005 -0.6963 0.0198 0.6784 3.5199
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 0.00000 0.0000
## Residual 0.02947 0.1717
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -1.415e-01 2.814e-02 1.009e+03
## redData$age_y 2.571e-02 6.026e-03 1.009e+03
## redData$feed_group2 -1.045e-02 1.206e-02 1.009e+03
## redData$feed_groupNULL -1.499e-02 1.546e-02 1.009e+03
## redData$genetic_groupS -1.262e-02 1.134e-02 1.009e+03
## as.factor(redData$sample_year)2011 3.952e-02 2.266e-02 1.009e+03
## as.factor(redData$sample_year)2012 6.065e-02 2.218e-02 1.009e+03
## as.factor(redData$sample_year)2013 8.106e-02 2.358e-02 1.009e+03
## as.factor(redData$sample_year)2014 5.035e-02 2.745e-02 1.009e+03
## as.numeric(paste(redData$sample_interval)) 1.029e-05 5.207e-05 1.009e+03
## t value Pr(>|t|)
## (Intercept) -5.029 5.83e-07 ***
## redData$age_y 4.266 2.18e-05 ***
## redData$feed_group2 -0.867 0.386405
## redData$feed_groupNULL -0.969 0.332699
## redData$genetic_groupS -1.113 0.265975
## as.factor(redData$sample_year)2011 1.744 0.081532 .
## as.factor(redData$sample_year)2012 2.735 0.006353 **
## as.factor(redData$sample_year)2013 3.438 0.000609 ***
## as.factor(redData$sample_year)2014 1.834 0.066902 .
## as.numeric(paste(redData$sample_interval)) 0.198 0.843439
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) rdDt$_ rdD$_2 rD$_NU rdD$_S a.(D$_)2011 a.(D$_)2012
## redData$g_y -0.203
## rdDt$fd_gr2 -0.219 -0.099
## rdDt$f_NULL -0.197 0.114 0.370
## rdDt$gntc_S -0.263 0.090 -0.029 0.243
## a.(D$_)2011 -0.460 -0.141 0.018 -0.065 -0.017
## a.(D$_)2012 -0.493 -0.259 0.034 -0.028 -0.013 0.703
## a.(D$_)2013 -0.373 -0.442 0.045 -0.077 -0.041 0.694 0.755
## a.(D$_)2014 -0.215 -0.615 0.047 -0.092 -0.074 0.633 0.708
## as.n((D$_)) -0.661 -0.033 0.047 -0.034 0.071 -0.045 0.016
## a.(D$_)2013 a.(D$_)2014
## redData$g_y
## rdDt$fd_gr2
## rdDt$f_NULL
## rdDt$gntc_S
## a.(D$_)2011
## a.(D$_)2012
## a.(D$_)2013
## a.(D$_)2014 0.798
## as.n((D$_)) -0.047 -0.113
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(red_mod)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## redData$age_y 0.53630 0.53630 1 1009 18.2001
## redData$feed_group 0.03650 0.01825 2 1009 0.6193
## redData$genetic_group 0.03650 0.03650 1 1009 1.2388
## as.factor(redData$sample_year) 0.45210 0.11303 4 1009 3.8357
## as.numeric(paste(redData$sample_interval)) 0.00115 0.00115 1 1009 0.0390
## Pr(>F)
## redData$age_y 2.176e-05 ***
## redData$feed_group 0.538542
## redData$genetic_group 0.265975
## as.factor(redData$sample_year) 0.004224 **
## as.numeric(paste(redData$sample_interval)) 0.843439
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(red_mod)
## [1] -603.817
tableS3<-as.data.frame(round(coef(summary(red_mod)),3))
write.csv(tableS3, "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/tableS3.csv")
tableS4<-as.data.frame(anova(red_mod))
write.csv(tableS4, "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/tableS4.csv")
red_mod_fac<-lmer(as.numeric(paste(redData$diff_rltl_res)) ~
redData$AgeGroup +
redData$feed_group +
redData$genetic_group+
as.factor(redData$sample_year) +
as.numeric(paste(redData$sample_interval)) +
(1|redData$recoded_id),
na.action=na.exclude)
## boundary (singular) fit: see ?isSingular
summary(red_mod_fac)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: as.numeric(paste(redData$diff_rltl_res)) ~ redData$AgeGroup +
## redData$feed_group + redData$genetic_group + as.factor(redData$sample_year) +
## as.numeric(paste(redData$sample_interval)) + (1 | redData$recoded_id)
##
## REML criterion at convergence: -627
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.6485 -0.6865 0.0273 0.6787 3.3620
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 0.00000 0.0000
## Residual 0.02956 0.1719
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -5.148e-02 3.238e-02 1.009e+03
## redData$AgeGroupyoung -7.262e-02 1.872e-02 1.009e+03
## redData$feed_group2 -5.832e-03 1.202e-02 1.009e+03
## redData$feed_groupNULL -1.786e-02 1.543e-02 1.009e+03
## redData$genetic_groupS -1.565e-02 1.131e-02 1.009e+03
## as.factor(redData$sample_year)2011 3.683e-02 2.286e-02 1.009e+03
## as.factor(redData$sample_year)2012 6.164e-02 2.229e-02 1.009e+03
## as.factor(redData$sample_year)2013 9.536e-02 2.256e-02 1.009e+03
## as.factor(redData$sample_year)2014 9.386e-02 2.289e-02 1.009e+03
## as.numeric(paste(redData$sample_interval)) -7.172e-05 5.697e-05 1.009e+03
## t value Pr(>|t|)
## (Intercept) -1.590 0.112162
## redData$AgeGroupyoung -3.880 0.000111 ***
## redData$feed_group2 -0.485 0.627658
## redData$feed_groupNULL -1.157 0.247431
## redData$genetic_groupS -1.383 0.166882
## as.factor(redData$sample_year)2011 1.611 0.107479
## as.factor(redData$sample_year)2012 2.765 0.005797 **
## as.factor(redData$sample_year)2013 4.226 2.59e-05 ***
## as.factor(redData$sample_year)2014 4.100 4.46e-05 ***
## as.numeric(paste(redData$sample_interval)) -1.259 0.208366
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) rdD$AG rdD$_2 rD$_NU rdD$_S a.(D$_)2011 a.(D$_)2012
## rdDt$AgGrpy -0.523
## rdDt$fd_gr2 -0.214 0.010
## rdDt$f_NULL -0.111 -0.078 0.383
## rdDt$gntc_S -0.198 -0.031 -0.020 0.237
## a.(D$_)2011 -0.518 0.184 0.006 -0.063 -0.010
## a.(D$_)2012 -0.615 0.272 0.012 -0.020 0.002 0.709
## a.(D$_)2013 -0.602 0.345 0.005 -0.055 -0.012 0.720 0.761
## a.(D$_)2014 -0.523 0.321 -0.013 -0.051 -0.032 0.710 0.744
## as.n((D$_)) -0.743 0.404 0.044 -0.059 0.056 0.029 0.117
## a.(D$_)2013 a.(D$_)2014
## rdDt$AgGrpy
## rdDt$fd_gr2
## rdDt$f_NULL
## rdDt$gntc_S
## a.(D$_)2011
## a.(D$_)2012
## a.(D$_)2013
## a.(D$_)2014 0.772
## as.n((D$_)) 0.080 -0.017
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(red_mod_fac)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## redData$AgeGroup 0.44503 0.44503 1 1009 15.0564
## redData$feed_group 0.03965 0.01982 2 1009 0.6707
## redData$genetic_group 0.05656 0.05656 1 1009 1.9135
## as.factor(redData$sample_year) 0.80475 0.20119 4 1009 6.8066
## as.numeric(paste(redData$sample_interval)) 0.04684 0.04684 1 1009 1.5848
## Pr(>F)
## redData$AgeGroup 0.0001111 ***
## redData$feed_group 0.5115971
## redData$genetic_group 0.1668816
## as.factor(redData$sample_year) 2.09e-05 ***
## as.numeric(paste(redData$sample_interval)) 0.2083656
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(red_mod_fac)
## [1] -602.9877
anova(red_mod, red_mod_fac)
## refitting model(s) with ML (instead of REML)
## Data: NULL
## Models:
## red_mod: as.numeric(paste(redData$diff_rltl_res)) ~ redData$age_y + redData$feed_group +
## red_mod: redData$genetic_group + as.factor(redData$sample_year) +
## red_mod: as.numeric(paste(redData$sample_interval)) + (1 | redData$recoded_id)
## red_mod_fac: as.numeric(paste(redData$diff_rltl_res)) ~ redData$AgeGroup +
## red_mod_fac: redData$feed_group + redData$genetic_group + as.factor(redData$sample_year) +
## red_mod_fac: as.numeric(paste(redData$sample_interval)) + (1 | redData$recoded_id)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## red_mod 12 -685.70 -626.58 354.85 -709.70
## red_mod_fac 12 -682.58 -623.46 353.29 -706.58 0 0
#t test with average productivity in the model for animals that have productivity measurements:
PData <- subset(redData, redData$amp_305_lactation != "NULL")
nrow(PData)
## [1] 917
length(unique(PData$recoded_id))
## [1] 253
rescaled_prod <- as.numeric(paste(PData$amp_305_lactation))/1000
# milk productivity measures are on a completely differenc scale and are therefore re-scaled by dividing them by 1000
prod_mod <- lmer(as.numeric(paste(PData$diff_rltl_res)) ~
PData$age_y +
PData$feed_group +
PData$genetic_group +
as.factor(PData$sample_year) +
as.numeric(paste(PData$sample_interval)) +
rescaled_prod +
(1|PData$recoded_id),
na.action=na.exclude)
## boundary (singular) fit: see ?isSingular
summary(prod_mod)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(PData$diff_rltl_res)) ~ PData$age_y + PData$feed_group +
## PData$genetic_group + as.factor(PData$sample_year) + as.numeric(paste(PData$sample_interval)) +
## rescaled_prod + (1 | PData$recoded_id)
##
## REML criterion at convergence: -555.3
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.5406 -0.6846 0.0104 0.7107 3.4856
##
## Random effects:
## Groups Name Variance Std.Dev.
## PData$recoded_id (Intercept) 0.00000 0.0000
## Residual 0.02931 0.1712
## Number of obs: 917, groups: PData$recoded_id, 253
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -1.427e-01 3.518e-02 9.060e+02
## PData$age_y 2.069e-02 6.722e-03 9.060e+02
## PData$feed_group2 -5.600e-03 1.305e-02 9.060e+02
## PData$feed_groupNULL 9.214e-03 2.429e-02 9.060e+02
## PData$genetic_groupS -1.131e-02 1.222e-02 9.060e+02
## as.factor(PData$sample_year)2011 3.763e-02 2.357e-02 9.060e+02
## as.factor(PData$sample_year)2012 5.980e-02 2.300e-02 9.060e+02
## as.factor(PData$sample_year)2013 8.593e-02 2.515e-02 9.060e+02
## as.factor(PData$sample_year)2014 6.353e-02 2.981e-02 9.060e+02
## as.numeric(paste(PData$sample_interval)) -2.573e-05 5.582e-05 9.060e+02
## rescaled_prod 2.735e-03 2.840e-03 9.060e+02
## t value Pr(>|t|)
## (Intercept) -4.057 5.41e-05 ***
## PData$age_y 3.078 0.002150 **
## PData$feed_group2 -0.429 0.667985
## PData$feed_groupNULL 0.379 0.704485
## PData$genetic_groupS -0.926 0.354903
## as.factor(PData$sample_year)2011 1.597 0.110645
## as.factor(PData$sample_year)2012 2.600 0.009470 **
## as.factor(PData$sample_year)2013 3.417 0.000662 ***
## as.factor(PData$sample_year)2014 2.131 0.033321 *
## as.numeric(paste(PData$sample_interval)) -0.461 0.644976
## rescaled_prod 0.963 0.335712
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) PDt$g_ PDt$_2 PD$_NU PDt$_S a.(PD$_)2011 a.(PD$_)2012
## PData$age_y -0.081
## PDt$fd_grp2 -0.369 -0.163
## PDt$fd_NULL -0.409 -0.143 0.452
## PDt$gntc_gS -0.032 0.102 -0.130 -0.006
## a.(PD$_)2011 -0.389 -0.149 0.025 -0.001 -0.030
## a.(PD$_)2012 -0.417 -0.284 0.050 0.048 -0.034 0.693
## a.(PD$_)2013 -0.327 -0.493 0.083 0.082 -0.064 0.671 0.750
## a.(PD$_)2014 -0.201 -0.662 0.089 0.091 -0.080 0.604 0.702
## as.((PD$_)) -0.556 0.008 0.033 -0.064 0.059 -0.028 0.014
## rescald_prd -0.542 -0.178 0.376 0.599 -0.283 0.016 0.039
## a.(PD$_)2013 a.(PD$_)2014 a.((PD
## PData$age_y
## PDt$fd_grp2
## PDt$fd_NULL
## PDt$gntc_gS
## a.(PD$_)2011
## a.(PD$_)2012
## a.(PD$_)2013
## a.(PD$_)2014 0.805
## as.((PD$_)) -0.065 -0.124
## rescald_prd 0.094 0.099 -0.036
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(prod_mod)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## PData$age_y 0.27757 0.277574 1 906 9.4712
## PData$feed_group 0.01751 0.008753 2 906 0.2987
## PData$genetic_group 0.02511 0.025108 1 906 0.8567
## as.factor(PData$sample_year) 0.40514 0.101285 4 906 3.4560
## as.numeric(paste(PData$sample_interval)) 0.00623 0.006226 1 906 0.2124
## rescaled_prod 0.02719 0.027189 1 906 0.9277
## Pr(>F)
## PData$age_y 0.002150 **
## PData$feed_group 0.741877
## PData$genetic_group 0.354903
## as.factor(PData$sample_year) 0.008192 **
## as.numeric(paste(PData$sample_interval)) 0.644976
## rescaled_prod 0.335712
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
tableS5<-as.data.frame(round(coef(summary(prod_mod)),3))
write.csv(tableS5, "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/tableS5.csv")
tableS6<-as.data.frame(anova(prod_mod))
write.csv(tableS6, "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/tableS6.csv")
One factor that may influence telomere length dynamics in dairy cattle and explain yearly variation in telomere length attrition is weather. Previously, harsher weather has been shown to correlate with more telomere length attrition in the bat species Myotis myotis (REFS). Also, yearly effects on telomere length that may indicate environmental factors such as weather have been observed in Soay sheep and European badgers (REFS). In two cross-sectional studies, black bears that live at a higher altitude (and therefore colder climate) were shown to have shorter telomeres and similarly Roe deer living in a harsher habitat had shorter telomeres than those animals in an habitat with milder weather and better food resources. Dairy cattle nowadays are often kept in stables that provide a roof to keep the animals dry, but are open on the sides to allow free air circulation. Dairy cattle are metabolically so active, that they feel most comfortable at temperatures at around 15 degrees celsius. They struggle more with too hot temperatures than too cold ones. All animals at Crichton are kept indoors during the winter, but the high forage feeding group is turned out for grazing over the summer months. Therefore, this group is more exposed to weather such as precipitation. Weather may also indirectly influence telomere length in dairy cattle by having an impact on food quality which ay vary from year to year.
Weather data was obtained from the metoffice weather station in Eskdalemuir (Location 323400E 602600N, Lat 55.311 Lon -3.206, 242m amsl) on the 3rd of August 2020. Eskdakenuir is with 21.8 miles (35.1 km) direct distance (calculated with freemaptools) the closest weather station to the farm in Dumfries. Weather data included maximum temperature, minimum temperature, days of air frost, total rain in mm and total sun hours for each recoreded month. Data was reduced to the years of interest between 2006 and 2015 and summarised to maximise its relevance considering the sampling interval on the farm to quarterly and yearly statistics in the following way: Routine blood sampling was performed in March and therefore the calendar year was divided into quartals and then allocated to a “sample year” which ran from April the previous year to end of March of the year when the blood samples were taken. By doing this sampling intervals for weather and telomere data was synchronised.
The dataset that was used above to investigate initial change in telomere lenght within the first year of life, one sample was taken shortly after birth and a second close to the age of one year. The sampling interval for those animals was the most consistant and therefore used to test the hypothesis that environmental factors such as weather may add to the variation in telomere length dynamics during the majour growth phase of the animals.
init_weath<-merge(init_change_dat, weather, by ="sample_year")
levels(as.factor(init_change_dat$sample_year))
## [1] "2010" "2011" "2012" "2013" "2014"
year_mod <- lmer(as.numeric(paste(init_weath$ResDiff)) ~
as.factor(init_change_dat$sample_year) +
init_change_dat$TimeMeasure +
(1|init_weath$recoded_id),
na.action=na.exclude)
summary(year_mod)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(init_weath$ResDiff)) ~ as.factor(init_change_dat$sample_year) +
## init_change_dat$TimeMeasure + (1 | init_weath$recoded_id)
##
## REML criterion at convergence: -157.1
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.1696 -0.3965 0.0367 0.4326 2.3339
##
## Random effects:
## Groups Name Variance Std.Dev.
## init_weath$recoded_id (Intercept) 0.01769 0.1330
## Residual 0.01237 0.1112
## Number of obs: 291, groups: init_weath$recoded_id, 283
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -1.825e-01 4.121e-02 2.515e+02
## as.factor(init_change_dat$sample_year)2011 1.835e-02 2.598e-02 2.511e+02
## as.factor(init_change_dat$sample_year)2012 2.132e-02 2.770e-02 2.783e+02
## as.factor(init_change_dat$sample_year)2013 5.287e-02 4.189e-02 2.334e+02
## as.factor(init_change_dat$sample_year)2014 1.049e-01 9.273e-02 2.836e+02
## init_change_dat$TimeMeasure 2.782e-05 1.868e-05 2.744e+02
## t value Pr(>|t|)
## (Intercept) -4.428 1.42e-05 ***
## as.factor(init_change_dat$sample_year)2011 0.707 0.481
## as.factor(init_change_dat$sample_year)2012 0.770 0.442
## as.factor(init_change_dat$sample_year)2013 1.262 0.208
## as.factor(init_change_dat$sample_year)2014 1.131 0.259
## init_change_dat$TimeMeasure 1.489 0.138
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) a.(__$_)2011 a.(__$_)2012 a.(__$_)2013 a.(__$_)2014
## a.(__$_)2011 -0.428
## a.(__$_)2012 -0.513 0.539
## a.(__$_)2013 -0.624 0.371 0.410
## a.(__$_)2014 -0.352 0.180 0.206 0.228
## int_chn_$TM -0.884 0.098 0.212 0.470 0.288
anova(year_mod)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## as.factor(init_change_dat$sample_year) 0.029464 0.007366 4 266.20 0.5953
## init_change_dat$TimeMeasure 0.027436 0.027436 1 274.39 2.2175
## Pr(>F)
## as.factor(init_change_dat$sample_year) 0.6663
## init_change_dat$TimeMeasure 0.1376
w1 <- ggplot(init_weath,
aes(x=maxT_Q2 , y = as.numeric(paste(init_weath$ResDiff)))) +
geom_point(colour = mycoloursP[6]) +
xlab("Max summer temperature °C") +
ylab("Change in RLTL") +
geom_smooth(method = lm) +
theme_bw(15)
Change in telomere length calves seems to be not significantly associated with sample year so it is difficult to argue for an effect of weather on change in RLTL length in early life. Other environmental stressors may have a larger impact or genetics may drive this effect. Maybe the sampling intervals are not consistant enogough?
Intitial change data
plot_data<- init_change_dat
plot_data$S_date0 <-as.Date(plot_data$S_date0, "%d/%m/%Y")
plot_data$S_date1 <-as.Date(plot_data$S_date1, "%d/%m/%Y")
plot_data1 <- data.frame(sample_date = plot_data$S_date0,
recoded_id = as.factor(paste(plot_data$recoded_id)))
plot_data2 <- data.frame(sample_date = plot_data$S_date1,
recoded_id = as.factor(paste(plot_data$recoded_id)))
plot_data <- rbind(plot_data1, plot_data2)
ggplot(plot_data, aes(sample_date, recoded_id, colour = recoded_id)) +
geom_line(size = 2) +
xlab("") + ylab("") +
theme_classic() + theme(legend.position="none")
To better visualise sampling intervals for calves, the first 50 individuals (which are in randm order, because dummy IDs were given randomly) are visualised.
subboul <- plot_data$recoded_id[1:50]
sub50 <- subset(plot_data, plot_data$recoded_id %in% subboul)
ggplot(sub50, aes(sample_date, recoded_id, colour = recoded_id)) +
geom_line(size = 2) +
xlab("Sample Interval") + ylab("Calf ID") +
theme_classic() + theme(legend.position="none")
# max T per year
yTmax_mod_1 <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
redData$age_y +
redData$feed_group +
redData$genetic_group +
as.numeric(paste(redData$sample_interval)) +
redData$sampleYear_maxT +
(1|redData$recoded_id),
na.action=na.exclude)
## boundary (singular) fit: see ?isSingular
summary(yTmax_mod_1)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(redData$diff_rltl_res)) ~ redData$age_y + redData$feed_group +
## redData$genetic_group + as.numeric(paste(redData$sample_interval)) +
## redData$sampleYear_maxT + (1 | redData$recoded_id)
##
## REML criterion at convergence: -632.7
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.7678 -0.7103 0.0073 0.6666 3.2334
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 0.00000 0.0000
## Residual 0.02972 0.1724
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) 6.003e-02 8.485e-02 1.012e+03
## redData$age_y 3.626e-02 4.969e-03 1.012e+03
## redData$feed_group2 -1.251e-02 1.210e-02 1.012e+03
## redData$feed_groupNULL -1.136e-02 1.545e-02 1.012e+03
## redData$genetic_groupS -1.079e-02 1.136e-02 1.012e+03
## as.numeric(paste(redData$sample_interval)) 1.781e-05 5.197e-05 1.012e+03
## redData$sampleYear_maxT -9.257e-03 4.789e-03 1.012e+03
## t value Pr(>|t|)
## (Intercept) 0.707 0.4795
## redData$age_y 7.298 5.9e-13 ***
## redData$feed_group2 -1.034 0.3013
## redData$feed_groupNULL -0.735 0.4623
## redData$genetic_groupS -0.949 0.3426
## as.numeric(paste(redData$sample_interval)) 0.343 0.7319
## redData$sampleYear_maxT -1.933 0.0535 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) rdDt$_ rdD$_2 rD$_NU rdD$_S a.((D$
## redData$g_y 0.424
## rdDt$fd_gr2 -0.084 -0.086
## rdDt$f_NULL -0.012 0.092 0.375
## rdDt$gntc_S -0.015 0.071 -0.026 0.240
## as.n((D$_)) -0.069 -0.081 0.049 -0.044 0.066
## rdDt$smpY_T -0.962 -0.513 0.014 -0.058 -0.071 -0.146
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(yTmax_mod_1)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## redData$age_y 1.58266 1.58266 1 1012 53.2584
## redData$feed_group 0.03596 0.01798 2 1012 0.6050
## redData$genetic_group 0.02679 0.02679 1 1012 0.9013
## as.numeric(paste(redData$sample_interval)) 0.00349 0.00349 1 1012 0.1175
## redData$sampleYear_maxT 0.11102 0.11102 1 1012 3.7358
## Pr(>F)
## redData$age_y 5.903e-13 ***
## redData$feed_group 0.54627
## redData$genetic_group 0.34265
## as.numeric(paste(redData$sample_interval)) 0.73188
## redData$sampleYear_maxT 0.05354 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(yTmax_mod_1)
## [1] -614.7018
# min T per year
yTmin_mod_1 <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
redData$age_y +
redData$feed_group +
redData$genetic_group +
as.numeric(paste(redData$sample_interval)) +
redData$year_minT +
(1|redData$recoded_id),
na.action=na.exclude)
## boundary (singular) fit: see ?isSingular
summary(yTmin_mod_1)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(redData$diff_rltl_res)) ~ redData$age_y + redData$feed_group +
## redData$genetic_group + as.numeric(paste(redData$sample_interval)) +
## redData$year_minT + (1 | redData$recoded_id)
##
## REML criterion at convergence: -628.8
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.7570 -0.6954 0.0126 0.6688 3.2381
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 0.00000 0.0000
## Residual 0.02979 0.1726
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -8.778e-02 2.490e-02 1.012e+03
## redData$age_y 2.930e-02 4.673e-03 1.012e+03
## redData$feed_group2 -1.179e-02 1.212e-02 1.012e+03
## redData$feed_groupNULL -1.270e-02 1.545e-02 1.012e+03
## redData$genetic_groupS -1.260e-02 1.135e-02 1.012e+03
## as.numeric(paste(redData$sample_interval)) 5.077e-06 5.151e-05 1.012e+03
## redData$year_minT 2.654e-03 2.461e-03 1.012e+03
## t value Pr(>|t|)
## (Intercept) -3.526 0.000442 ***
## redData$age_y 6.270 5.33e-10 ***
## redData$feed_group2 -0.973 0.330823
## redData$feed_groupNULL -0.822 0.411408
## redData$genetic_groupS -1.110 0.267389
## as.numeric(paste(redData$sample_interval)) 0.099 0.921509
## redData$year_minT 1.078 0.281244
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) rdDt$_ rdD$_2 rD$_NU rdD$_S a.((D$
## redData$g_y -0.404
## rdDt$fd_gr2 -0.228 -0.096
## rdDt$f_NULL -0.222 0.057 0.377
## rdDt$gntc_S -0.292 0.045 -0.026 0.236
## as.n((D$_)) -0.709 -0.181 0.053 -0.052 0.056
## rdDt$yr_mnT 0.373 -0.405 0.030 0.024 -0.020 0.034
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(yTmin_mod_1)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## redData$age_y 1.17126 1.17126 1 1012 39.3143
## redData$feed_group 0.03539 0.01769 2 1012 0.5939
## redData$genetic_group 0.03669 0.03669 1 1012 1.2314
## as.numeric(paste(redData$sample_interval)) 0.00029 0.00029 1 1012 0.0097
## redData$year_minT 0.03463 0.03463 1 1012 1.1623
## Pr(>F)
## redData$age_y 5.334e-10 ***
## redData$feed_group 0.5524
## redData$genetic_group 0.2674
## as.numeric(paste(redData$sample_interval)) 0.9215
## redData$year_minT 0.2812
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(yTmin_mod_1)
## [1] -610.8005
#mean days of air frost per year
ymAF_mod_1 <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
redData$age_y +
redData$feed_group +
redData$genetic_group +
as.numeric(paste(redData$sample_interval)) +
redData$sampleYear_af_days_mean +
(1|redData$recoded_id),
na.action=na.exclude)
## boundary (singular) fit: see ?isSingular
summary(ymAF_mod_1)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(redData$diff_rltl_res)) ~ redData$age_y + redData$feed_group +
## redData$genetic_group + as.numeric(paste(redData$sample_interval)) +
## redData$sampleYear_af_days_mean + (1 | redData$recoded_id)
##
## REML criterion at convergence: -628.7
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.7662 -0.7062 0.0185 0.6724 3.2211
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 0.0000 0.0000
## Residual 0.0298 0.1726
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -1.174e-01 3.170e-02 1.012e+03
## redData$age_y 3.206e-02 4.348e-03 1.012e+03
## redData$feed_group2 -1.228e-02 1.211e-02 1.012e+03
## redData$feed_groupNULL -1.348e-02 1.545e-02 1.012e+03
## redData$genetic_groupS -1.224e-02 1.135e-02 1.012e+03
## as.numeric(paste(redData$sample_interval)) 2.658e-06 5.150e-05 1.012e+03
## redData$sampleYear_af_days_mean 2.490e-03 2.758e-03 1.012e+03
## t value Pr(>|t|)
## (Intercept) -3.704 0.000224 ***
## redData$age_y 7.375 3.41e-13 ***
## redData$feed_group2 -1.014 0.311040
## redData$feed_groupNULL -0.873 0.383095
## redData$genetic_groupS -1.078 0.281337
## as.numeric(paste(redData$sample_interval)) 0.052 0.958838
## redData$sampleYear_af_days_mean 0.903 0.366875
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) rdDt$_ rdD$_2 rD$_NU rdD$_S a.((D$
## redData$g_y -0.340
## rdDt$fd_gr2 -0.182 -0.092
## rdDt$f_NULL -0.162 0.066 0.377
## rdDt$gntc_S -0.231 0.041 -0.025 0.236
## as.n((D$_)) -0.559 -0.182 0.052 -0.053 0.057
## rdDt$smY___ -0.685 0.185 -0.009 -0.028 0.012 -0.011
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(ymAF_mod_1)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## redData$age_y 1.62114 1.62114 1 1012 54.3963
## redData$feed_group 0.03898 0.01949 2 1012 0.6540
## redData$genetic_group 0.03463 0.03463 1 1012 1.1619
## as.numeric(paste(redData$sample_interval)) 0.00008 0.00008 1 1012 0.0027
## redData$sampleYear_af_days_mean 0.02429 0.02429 1 1012 0.8150
## Pr(>F)
## redData$age_y 3.406e-13 ***
## redData$feed_group 0.5202
## redData$genetic_group 0.2813
## as.numeric(paste(redData$sample_interval)) 0.9588
## redData$sampleYear_af_days_mean 0.3669
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(ymAF_mod_1)
## [1] -610.6811
#max sun hours/month per year
#(n.s.)
yMaxSH_mod_1 <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
redData$age_y +
redData$feed_group +
redData$genetic_group +
as.numeric(paste(redData$sample_interval)) +
redData$sampleYear_sun_hours_max +
(1|redData$recoded_id),
na.action=na.exclude)
## boundary (singular) fit: see ?isSingular
summary(yMaxSH_mod_1)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(redData$diff_rltl_res)) ~ redData$age_y + redData$feed_group +
## redData$genetic_group + as.numeric(paste(redData$sample_interval)) +
## redData$sampleYear_sun_hours_max + (1 | redData$recoded_id)
##
## REML criterion at convergence: -626.7
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.7471 -0.6850 0.0149 0.6663 3.2573
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 0.00000 0.0000
## Residual 0.02973 0.1724
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -1.928e-01 5.749e-02 1.012e+03
## redData$age_y 2.859e-02 4.531e-03 1.012e+03
## redData$feed_group2 -1.152e-02 1.210e-02 1.012e+03
## redData$feed_groupNULL -1.225e-02 1.544e-02 1.012e+03
## redData$genetic_groupS -1.250e-02 1.134e-02 1.012e+03
## as.numeric(paste(redData$sample_interval)) 9.027e-06 5.153e-05 1.012e+03
## redData$sampleYear_sun_hours_max 5.556e-04 3.079e-04 1.012e+03
## t value Pr(>|t|)
## (Intercept) -3.354 0.000827 ***
## redData$age_y 6.310 4.17e-10 ***
## redData$feed_group2 -0.952 0.341422
## redData$feed_groupNULL -0.794 0.427428
## redData$genetic_groupS -1.102 0.270608
## as.numeric(paste(redData$sample_interval)) 0.175 0.860981
## redData$sampleYear_sun_hours_max 1.804 0.071490 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) rdDt$_ rdD$_2 rD$_NU rdD$_S a.((D$
## redData$g_y 0.195
## rdDt$fd_gr2 -0.131 -0.096
## rdDt$f_NULL -0.127 0.058 0.377
## rdDt$gntc_S -0.117 0.040 -0.025 0.236
## as.n((D$_)) -0.369 -0.193 0.054 -0.051 0.056
## rdDt$smY___ -0.916 -0.336 0.030 0.030 -0.007 0.063
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(yMaxSH_mod_1)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## redData$age_y 1.18371 1.18371 1 1012 39.8142
## redData$feed_group 0.03349 0.01674 2 1012 0.5632
## redData$genetic_group 0.03612 0.03612 1 1012 1.2150
## as.numeric(paste(redData$sample_interval)) 0.00091 0.00091 1 1012 0.0307
## redData$sampleYear_sun_hours_max 0.09678 0.09678 1 1012 3.2553
## Pr(>F)
## redData$age_y 4.17e-10 ***
## redData$feed_group 0.56955
## redData$genetic_group 0.27061
## as.numeric(paste(redData$sample_interval)) 0.86098
## redData$sampleYear_sun_hours_max 0.07149 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(yMaxSH_mod_1)
## [1] -608.7338
#mean precipitation per year
#(n.s.)
y_rain <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
redData$age_y +
redData$feed_group +
redData$genetic_group +
as.numeric(paste(redData$sample_interval)) +
redData$sampleYear_mean_rain +
(1|redData$recoded_id),
na.action=na.exclude)
## boundary (singular) fit: see ?isSingular
summary(y_rain)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(redData$diff_rltl_res)) ~ redData$age_y + redData$feed_group +
## redData$genetic_group + as.numeric(paste(redData$sample_interval)) +
## redData$sampleYear_mean_rain + (1 | redData$recoded_id)
##
## REML criterion at convergence: -623.2
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.7658 -0.7120 0.0134 0.6762 3.2228
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 0.00000 0.0000
## Residual 0.02981 0.1727
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -8.982e-02 2.606e-02 1.012e+03
## redData$age_y 3.363e-02 5.496e-03 1.012e+03
## redData$feed_group2 -1.243e-02 1.212e-02 1.012e+03
## redData$feed_groupNULL -1.257e-02 1.547e-02 1.012e+03
## redData$genetic_groupS -1.178e-02 1.139e-02 1.012e+03
## as.numeric(paste(redData$sample_interval)) 7.285e-06 5.188e-05 1.012e+03
## redData$sampleYear_mean_rain -1.416e-04 2.139e-04 1.012e+03
## t value Pr(>|t|)
## (Intercept) -3.447 0.000591 ***
## redData$age_y 6.119 1.35e-09 ***
## redData$feed_group2 -1.026 0.305203
## redData$feed_groupNULL -0.812 0.416839
## redData$genetic_groupS -1.034 0.301394
## as.numeric(paste(redData$sample_interval)) 0.140 0.888352
## redData$sampleYear_mean_rain -0.662 0.508058
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) rdDt$_ rdD$_2 rD$_NU rdD$_S a.((D$
## redData$g_y 0.086
## rdDt$fd_gr2 -0.244 -0.091
## rdDt$f_NULL -0.197 0.089 0.374
## rdDt$gntc_S -0.235 0.079 -0.028 0.240
## as.n((D$_)) -0.630 -0.066 0.048 -0.047 0.065
## rdDt$smpY__ -0.462 -0.629 0.032 -0.052 -0.077 -0.120
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(y_rain)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## redData$age_y 1.11625 1.11625 1 1012 37.4410
## redData$feed_group 0.03773 0.01887 2 1012 0.6328
## redData$genetic_group 0.03187 0.03187 1 1012 1.0691
## as.numeric(paste(redData$sample_interval)) 0.00059 0.00059 1 1012 0.0197
## redData$sampleYear_mean_rain 0.01307 0.01307 1 1012 0.4384
## Pr(>F)
## redData$age_y 1.345e-09 ***
## redData$feed_group 0.5313
## redData$genetic_group 0.3014
## as.numeric(paste(redData$sample_interval)) 0.8884
## redData$sampleYear_mean_rain 0.5081
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(y_rain)
## [1] -605.1902
max temperature
#maxT spring
#
yMaxSH_mod_1 <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
redData$age_y +
redData$feed_group +
redData$genetic_group +
as.numeric(paste(redData$sample_interval)) +
redData$maxT_Q1 +
(1|redData$recoded_id),
na.action=na.exclude)
## boundary (singular) fit: see ?isSingular
summary(yMaxSH_mod_1)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(redData$diff_rltl_res)) ~ redData$age_y + redData$feed_group +
## redData$genetic_group + as.numeric(paste(redData$sample_interval)) +
## redData$maxT_Q1 + (1 | redData$recoded_id)
##
## REML criterion at convergence: -628.8
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.7673 -0.7049 0.0199 0.6740 3.2206
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 0.00000 0.0000
## Residual 0.02979 0.1726
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -7.302e-02 3.210e-02 1.012e+03
## redData$age_y 3.070e-02 4.310e-03 1.012e+03
## redData$feed_group2 -1.211e-02 1.211e-02 1.012e+03
## redData$feed_groupNULL -1.395e-02 1.546e-02 1.012e+03
## redData$genetic_groupS -1.257e-02 1.135e-02 1.012e+03
## as.numeric(paste(redData$sample_interval)) 2.179e-07 5.155e-05 1.012e+03
## redData$maxT_Q1 -2.644e-03 2.379e-03 1.012e+03
## t value Pr(>|t|)
## (Intercept) -2.275 0.0231 *
## redData$age_y 7.125 1.98e-12 ***
## redData$feed_group2 -1.000 0.3177
## redData$feed_groupNULL -0.902 0.3671
## redData$genetic_groupS -1.107 0.2685
## as.numeric(paste(redData$sample_interval)) 0.004 0.9966
## redData$maxT_Q1 -1.111 0.2666
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) rdDt$_ rdD$_2 rD$_NU rdD$_S a.((D$
## redData$g_y -0.304
## rdDt$fd_gr2 -0.182 -0.092
## rdDt$f_NULL -0.214 0.078 0.376
## rdDt$gntc_S -0.232 0.042 -0.025 0.237
## as.n((D$_)) -0.595 -0.174 0.052 -0.050 0.058
## rdDt$mxT_Q1 -0.694 0.132 -0.005 0.050 0.017 0.052
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(yMaxSH_mod_1)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## redData$age_y 1.51216 1.51216 1 1012 50.7605
## redData$feed_group 0.03938 0.01969 2 1012 0.6610
## redData$genetic_group 0.03652 0.03652 1 1012 1.2260
## as.numeric(paste(redData$sample_interval)) 0.00000 0.00000 1 1012 0.0000
## redData$maxT_Q1 0.03680 0.03680 1 1012 1.2353
## Pr(>F)
## redData$age_y 1.98e-12 ***
## redData$feed_group 0.5165
## redData$genetic_group 0.2685
## as.numeric(paste(redData$sample_interval)) 0.9966
## redData$maxT_Q1 0.2666
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(yMaxSH_mod_1)
## [1] -610.8054
#maxT summer
#(s!)
yMaxSuH_mod_1 <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
redData$age_y +
redData$feed_group +
redData$genetic_group +
as.numeric(paste(redData$sample_interval)) +
redData$maxT_Q2 +
(1|redData$recoded_id),
na.action=na.exclude)
## boundary (singular) fit: see ?isSingular
summary(yMaxSuH_mod_1)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(redData$diff_rltl_res)) ~ redData$age_y + redData$feed_group +
## redData$genetic_group + as.numeric(paste(redData$sample_interval)) +
## redData$maxT_Q2 + (1 | redData$recoded_id)
##
## REML criterion at convergence: -639.1
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.6889 -0.6678 0.0205 0.6675 3.3379
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 0.00000 0.0000
## Residual 0.02951 0.1718
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) 9.270e-02 6.248e-02 1.012e+03
## redData$age_y 2.812e-02 4.364e-03 1.012e+03
## redData$feed_group2 -1.099e-02 1.206e-02 1.012e+03
## redData$feed_groupNULL -1.239e-02 1.537e-02 1.012e+03
## redData$genetic_groupS -1.206e-02 1.130e-02 1.012e+03
## as.numeric(paste(redData$sample_interval)) 1.676e-05 5.141e-05 1.012e+03
## redData$maxT_Q2 -1.156e-02 3.525e-03 1.012e+03
## t value Pr(>|t|)
## (Intercept) 1.484 0.13821
## redData$age_y 6.444 1.79e-10 ***
## redData$feed_group2 -0.911 0.36235
## redData$feed_groupNULL -0.806 0.42035
## redData$genetic_groupS -1.068 0.28584
## as.numeric(paste(redData$sample_interval)) 0.326 0.74451
## redData$maxT_Q2 -3.279 0.00108 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) rdDt$_ rdD$_2 rD$_NU rdD$_S a.((D$
## redData$g_y -0.316
## rdDt$fd_gr2 -0.067 -0.096
## rdDt$f_NULL -0.079 0.068 0.377
## rdDt$gntc_S -0.105 0.037 -0.025 0.237
## as.n((D$_)) -0.210 -0.196 0.054 -0.052 0.057
## rdDt$mxT_Q2 -0.930 0.225 -0.030 -0.014 -0.008 -0.081
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(yMaxSuH_mod_1)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## redData$age_y 1.22567 1.22567 1 1012 41.5301
## redData$feed_group 0.03187 0.01594 2 1012 0.5400
## redData$genetic_group 0.03365 0.03365 1 1012 1.1403
## as.numeric(paste(redData$sample_interval)) 0.00314 0.00314 1 1012 0.1063
## redData$maxT_Q2 0.31728 0.31728 1 1012 10.7507
## Pr(>F)
## redData$age_y 1.793e-10 ***
## redData$feed_group 0.582909
## redData$genetic_group 0.285844
## as.numeric(paste(redData$sample_interval)) 0.744511
## redData$maxT_Q2 0.001078 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(yMaxSuH_mod_1)
## [1] -621.0605
w2 <- ggplot(redData,
aes(x=maxT_Q2 , y = as.numeric(paste(redData$diff_rltl_res)))) +
geom_point(colour = mycoloursP[6]) +
xlab("Max summer temperature in °C") +
ylab("Change in RLTL") +
geom_smooth(method = lm) +
theme_bw(15)
grid.arrange(w1, w2, ncol = 2)
## Warning: Use of `init_weath$ResDiff` is discouraged. Use `ResDiff` instead.
## Warning: Use of `init_weath$ResDiff` is discouraged. Use `ResDiff` instead.
## `geom_smooth()` using formula 'y ~ x'
## Warning: Use of `redData$diff_rltl_res` is discouraged. Use `diff_rltl_res`
## instead.
## Warning: Use of `redData$diff_rltl_res` is discouraged. Use `diff_rltl_res`
## instead.
## `geom_smooth()` using formula 'y ~ x'
#first plot is relationship between summer temperature and RLTL change in calves, second in adults.
sam_year<- as.factor(redData$sample_year)
tel_change<-as.numeric(paste(redData$diff_rltl_res))
ggplot(redData, aes(x=maxT_Q2, y = tel_change)) +
xlab("Max summer temperature in °C") +
ylab("Change in RLTL") + theme_bw(15) +
geom_point(colour = sam_year) +
scale_colour_manual(values = mycoloursP) +
geom_smooth(method = lm, formula = y~x)
fig2 <- ggplot(redData, aes(x=maxT_Q2, y = tel_change)) +
xlab("Max summer temperature in °C") +
ylab("Change in RLTL") +
theme_bw(15) +
geom_point(aes(colour = sam_year)) +
scale_colour_manual(values = mycoloursP) +
geom_smooth(method = lm, formula = y~x)
pdf(file = "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/output/Fig2.pdf", width = 8, height = 5)
print(fig2)
dev.off()
## quartz_off_screen
## 2
tableS8 <- as.data.frame(round(coef(summary(yMaxSuH_mod_1)),3))
write.csv(tableS8, "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/tableS8.csv")
tableS9 <- as.data.frame(anova(yMaxSuH_mod_1))
write.csv(tableS9, "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/tableS9.csv")
### does sample year remain significant with max temp in the model?
yMaxSuH_year <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
redData$age_y +
redData$feed_group +
redData$genetic_group +
as.numeric(paste(redData$sample_interval)) +
redData$sample_year +
redData$maxT_Q2 +
(1|redData$recoded_id),
na.action=na.exclude)
## boundary (singular) fit: see ?isSingular
summary(yMaxSuH_year)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(redData$diff_rltl_res)) ~ redData$age_y + redData$feed_group +
## redData$genetic_group + as.numeric(paste(redData$sample_interval)) +
## redData$sample_year + redData$maxT_Q2 + (1 | redData$recoded_id)
##
## REML criterion at convergence: -631.6
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.6483 -0.6649 0.0158 0.6766 3.3750
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 5.674e-18 2.382e-09
## Residual 2.952e-02 1.718e-01
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -1.105e+01 1.379e+01 1.011e+03
## redData$age_y 2.479e-02 6.004e-03 1.011e+03
## redData$feed_group2 -1.056e-02 1.207e-02 1.011e+03
## redData$feed_groupNULL -1.362e-02 1.545e-02 1.011e+03
## redData$genetic_groupS -1.289e-02 1.135e-02 1.011e+03
## as.numeric(paste(redData$sample_interval)) 1.038e-05 5.202e-05 1.011e+03
## redData$sample_year 5.528e-03 6.844e-03 1.011e+03
## redData$maxT_Q2 -1.006e-02 3.986e-03 1.011e+03
## t value Pr(>|t|)
## (Intercept) -0.801 0.4233
## redData$age_y 4.129 3.95e-05 ***
## redData$feed_group2 -0.875 0.3820
## redData$feed_groupNULL -0.881 0.3783
## redData$genetic_groupS -1.136 0.2561
## as.numeric(paste(redData$sample_interval)) 0.200 0.8419
## redData$sample_year 0.808 0.4194
## redData$maxT_Q2 -2.523 0.0118 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) rdDt$g_ rdD$_2 rD$_NU rdD$_S a.((D$ rdDt$s_
## redData$g_y 0.686
## rdDt$fd_gr2 -0.045 -0.100
## rdDt$f_NULL 0.098 0.116 0.370
## rdDt$gntc_S 0.090 0.089 -0.029 0.243
## as.n((D$_)) 0.151 -0.036 0.047 -0.036 0.070
## rdDt$smpl_y -1.000 -0.687 0.044 -0.098 -0.090 -0.152
## rdDt$mxT_Q2 -0.470 -0.176 -0.006 -0.058 -0.049 -0.141 0.466
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(yMaxSuH_year)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## redData$age_y 0.50322 0.50322 1 1011 17.0450
## redData$feed_group 0.03321 0.01661 2 1011 0.5625
## redData$genetic_group 0.03812 0.03812 1 1011 1.2911
## as.numeric(paste(redData$sample_interval)) 0.00118 0.00118 1 1011 0.0398
## redData$sample_year 0.01926 0.01926 1 1011 0.6524
## redData$maxT_Q2 0.18793 0.18793 1 1011 6.3654
## Pr(>F)
## redData$age_y 3.951e-05 ***
## redData$feed_group 0.56997
## redData$genetic_group 0.25611
## as.numeric(paste(redData$sample_interval)) 0.84187
## redData$sample_year 0.41944
## redData$maxT_Q2 0.01179 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(yMaxSuH_year)
## [1] -611.582
tableS10<-as.data.frame(round(coef(summary(yMaxSuH_year)),3))
write.csv(tableS10, "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/tableS10.csv")
tableS11<-as.data.frame(anova(yMaxSuH_year))
write.csv(tableS11, "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/tableS11.csv")
### no sample year becomes nor significant, but max temp in summer remains significant
#maxT autumn
#(n.s.)
yMaxAH_mod_1 <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
redData$age_y +
redData$feed_group +
redData$genetic_group +
as.numeric(paste(redData$sample_interval)) +
redData$maxT_Q3 +
(1|redData$recoded_id),
na.action=na.exclude)
## boundary (singular) fit: see ?isSingular
summary(yMaxAH_mod_1)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(redData$diff_rltl_res)) ~ redData$age_y + redData$feed_group +
## redData$genetic_group + as.numeric(paste(redData$sample_interval)) +
## redData$maxT_Q3 + (1 | redData$recoded_id)
##
## REML criterion at convergence: -631.2
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.7478 -0.6997 0.0182 0.6674 3.2463
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 0.00000 0.0000
## Residual 0.02976 0.1725
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) 1.767e-02 7.954e-02 1.012e+03
## redData$age_y 3.586e-02 5.207e-03 1.012e+03
## redData$feed_group2 -1.258e-02 1.211e-02 1.012e+03
## redData$feed_groupNULL -1.205e-02 1.545e-02 1.012e+03
## redData$genetic_groupS -1.109e-02 1.137e-02 1.012e+03
## as.numeric(paste(redData$sample_interval)) 1.309e-05 5.187e-05 1.012e+03
## redData$maxT_Q3 -6.949e-03 4.580e-03 1.012e+03
## t value Pr(>|t|)
## (Intercept) 0.222 0.824
## redData$age_y 6.887 9.98e-12 ***
## redData$feed_group2 -1.039 0.299
## redData$feed_groupNULL -0.780 0.436
## redData$genetic_groupS -0.975 0.330
## as.numeric(paste(redData$sample_interval)) 0.252 0.801
## redData$maxT_Q3 -1.517 0.130
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) rdDt$_ rdD$_2 rD$_NU rdD$_S a.((D$
## redData$g_y 0.477
## rdDt$fd_gr2 -0.096 -0.088
## rdDt$f_NULL -0.030 0.085 0.375
## rdDt$gntc_S -0.019 0.075 -0.027 0.239
## as.n((D$_)) -0.103 -0.077 0.049 -0.047 0.065
## rdDt$mxT_Q3 -0.957 -0.572 0.022 -0.044 -0.073 -0.126
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(yMaxAH_mod_1)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## redData$age_y 1.41154 1.41154 1 1012 47.4329
## redData$feed_group 0.03740 0.01870 2 1012 0.6283
## redData$genetic_group 0.02830 0.02830 1 1012 0.9510
## as.numeric(paste(redData$sample_interval)) 0.00189 0.00189 1 1012 0.0636
## redData$maxT_Q3 0.06849 0.06849 1 1012 2.3015
## Pr(>F)
## redData$age_y 9.982e-12 ***
## redData$feed_group 0.5337
## redData$genetic_group 0.3297
## as.numeric(paste(redData$sample_interval)) 0.8009
## redData$maxT_Q3 0.1296
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(yMaxAH_mod_1)
## [1] -613.1811
#maxT winter
#(n.s.)
yMaxW_mod_1 <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
redData$age_y +
redData$feed_group +
redData$genetic_group +
as.numeric(paste(redData$sample_interval)) +
redData$maxT_Q4 +
(1|redData$recoded_id),
na.action=na.exclude)
## boundary (singular) fit: see ?isSingular
summary(yMaxW_mod_1)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(redData$diff_rltl_res)) ~ redData$age_y + redData$feed_group +
## redData$genetic_group + as.numeric(paste(redData$sample_interval)) +
## redData$maxT_Q4 + (1 | redData$recoded_id)
##
## REML criterion at convergence: -636
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.6972 -0.6907 0.0278 0.6689 3.3046
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 0.00000 0.0000
## Residual 0.02963 0.1721
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) 6.878e-02 6.782e-02 1.012e+03
## redData$age_y 3.160e-02 4.261e-03 1.012e+03
## redData$feed_group2 -1.188e-02 1.208e-02 1.012e+03
## redData$feed_groupNULL -1.435e-02 1.541e-02 1.012e+03
## redData$genetic_groupS -1.204e-02 1.132e-02 1.012e+03
## as.numeric(paste(redData$sample_interval)) 5.668e-06 5.135e-05 1.012e+03
## redData$maxT_Q4 -1.435e-02 5.495e-03 1.012e+03
## t value Pr(>|t|)
## (Intercept) 1.014 0.31069
## redData$age_y 7.416 2.55e-13 ***
## redData$feed_group2 -0.984 0.32536
## redData$feed_groupNULL -0.931 0.35209
## redData$genetic_groupS -1.063 0.28785
## as.numeric(paste(redData$sample_interval)) 0.110 0.91213
## redData$maxT_Q4 -2.612 0.00914 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) rdDt$_ rdD$_2 rD$_NU rdD$_S a.((D$
## redData$g_y -0.079
## rdDt$fd_gr2 -0.079 -0.091
## rdDt$f_NULL -0.114 0.072 0.376
## rdDt$gntc_S -0.094 0.040 -0.025 0.236
## as.n((D$_)) -0.247 -0.182 0.052 -0.054 0.057
## rdDt$mxT_Q4 -0.941 -0.023 -0.009 0.031 -0.011 -0.019
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(yMaxW_mod_1)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## redData$age_y 1.62936 1.62936 1 1012 54.9964
## redData$feed_group 0.03954 0.01977 2 1012 0.6673
## redData$genetic_group 0.03350 0.03350 1 1012 1.1309
## as.numeric(paste(redData$sample_interval)) 0.00036 0.00036 1 1012 0.0122
## redData$maxT_Q4 0.20207 0.20207 1 1012 6.8207
## Pr(>F)
## redData$age_y 2.55e-13 ***
## redData$feed_group 0.513322
## redData$genetic_group 0.287846
## as.numeric(paste(redData$sample_interval)) 0.912129
## redData$maxT_Q4 0.009144 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(yMaxW_mod_1)
## [1] -618.0486
tableS12 <- as.data.frame(round(coef(summary(yMaxW_mod_1)),3))
write.csv(tableS12, "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/tableS12.csv")
tableS13 <- as.data.frame(anova(yMaxW_mod_1))
write.csv(tableS13, "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/tableS13.csv")
# max T of summer and winter quarter in the same model
yMaxSW_mod_1 <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
redData$age_y +
redData$feed_group +
redData$genetic_group +
as.numeric(paste(redData$sample_interval)) +
redData$maxT_Q4 +
redData$maxT_Q2 +
(1|redData$recoded_id),
na.action=na.exclude)
## boundary (singular) fit: see ?isSingular
summary(yMaxSW_mod_1)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(redData$diff_rltl_res)) ~ redData$age_y + redData$feed_group +
## redData$genetic_group + as.numeric(paste(redData$sample_interval)) +
## redData$maxT_Q4 + redData$maxT_Q2 + (1 | redData$recoded_id)
##
## REML criterion at convergence: -632.1
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.6694 -0.6685 0.0223 0.6689 3.3536
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 0.0000 0.0000
## Residual 0.0295 0.1718
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) 1.401e-01 7.446e-02 1.011e+03
## redData$age_y 2.889e-02 4.412e-03 1.011e+03
## redData$feed_group2 -1.107e-02 1.206e-02 1.011e+03
## redData$feed_groupNULL -1.317e-02 1.539e-02 1.011e+03
## redData$genetic_groupS -1.196e-02 1.130e-02 1.011e+03
## as.numeric(paste(redData$sample_interval)) 1.534e-05 5.141e-05 1.011e+03
## redData$maxT_Q4 -7.346e-03 6.275e-03 1.011e+03
## redData$maxT_Q2 -9.262e-03 4.033e-03 1.011e+03
## t value Pr(>|t|)
## (Intercept) 1.882 0.0601 .
## redData$age_y 6.548 9.25e-11 ***
## redData$feed_group2 -0.919 0.3586
## redData$feed_groupNULL -0.856 0.3921
## redData$genetic_groupS -1.059 0.2900
## as.numeric(paste(redData$sample_interval)) 0.298 0.7655
## redData$maxT_Q4 -1.171 0.2420
## redData$maxT_Q2 -2.297 0.0218 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) rdDt$_ rdD$_2 rD$_NU rdD$_S a.((D$ rD$T_Q4
## redData$g_y -0.181
## rdDt$fd_gr2 -0.060 -0.096
## rdDt$f_NULL -0.089 0.060 0.377
## rdDt$gntc_S -0.084 0.038 -0.025 0.236
## as.n((D$_)) -0.189 -0.197 0.054 -0.051 0.057
## rdDt$mxT_Q4 -0.544 -0.150 0.006 0.043 -0.008 0.024
## rdDt$mxT_Q2 -0.417 0.267 -0.029 -0.033 -0.003 -0.082 -0.486
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(yMaxSW_mod_1)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## redData$age_y 1.26500 1.26500 1 1011 42.8784
## redData$feed_group 0.03384 0.01692 2 1011 0.5735
## redData$genetic_group 0.03307 0.03307 1 1011 1.1208
## as.numeric(paste(redData$sample_interval)) 0.00263 0.00263 1 1011 0.0890
## redData$maxT_Q4 0.04043 0.04043 1 1011 1.3705
## redData$maxT_Q2 0.15564 0.15564 1 1011 5.2756
## Pr(>F)
## redData$age_y 9.253e-11 ***
## redData$feed_group 0.56374
## redData$genetic_group 0.28999
## as.numeric(paste(redData$sample_interval)) 0.76552
## redData$maxT_Q4 0.24201
## redData$maxT_Q2 0.02183 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(yMaxSW_mod_1)
## [1] -612.1264
tableS14 <- as.data.frame(round(coef(summary(yMaxSW_mod_1)),3))
write.csv(tableS14, "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/tableS14.csv")
tableS15 <- as.data.frame(anova(yMaxSW_mod_1))
write.csv(tableS15, "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/tableS15.csv")
# same as above plus sample year
yMaxSW_year <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
redData$age_y +
redData$feed_group +
redData$genetic_group +
as.numeric(paste(redData$sample_interval)) +
redData$maxT_Q4 +
redData$maxT_Q2 +
redData$sample_year +
(1|redData$recoded_id), na.action=na.exclude)
## boundary (singular) fit: see ?isSingular
summary(yMaxSW_year)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(redData$diff_rltl_res)) ~ redData$age_y + redData$feed_group +
## redData$genetic_group + as.numeric(paste(redData$sample_interval)) +
## redData$maxT_Q4 + redData$maxT_Q2 + redData$sample_year +
## (1 | redData$recoded_id)
##
## REML criterion at convergence: -625
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.6172 -0.6784 0.0262 0.6816 3.4022
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 0.0000 0.0000
## Residual 0.0295 0.1718
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -1.369e+01 1.393e+01 1.010e+03
## redData$age_y 2.485e-02 6.003e-03 1.010e+03
## redData$feed_group2 -1.055e-02 1.207e-02 1.010e+03
## redData$feed_groupNULL -1.479e-02 1.547e-02 1.010e+03
## redData$genetic_groupS -1.297e-02 1.134e-02 1.010e+03
## as.numeric(paste(redData$sample_interval)) 7.235e-06 5.206e-05 1.010e+03
## redData$maxT_Q4 -8.280e-03 6.345e-03 1.010e+03
## redData$maxT_Q2 -7.105e-03 4.581e-03 1.010e+03
## redData$sample_year 6.867e-03 6.918e-03 1.010e+03
## t value Pr(>|t|)
## (Intercept) -0.983 0.326
## redData$age_y 4.141 3.75e-05 ***
## redData$feed_group2 -0.874 0.382
## redData$feed_groupNULL -0.956 0.339
## redData$genetic_groupS -1.144 0.253
## as.numeric(paste(redData$sample_interval)) 0.139 0.889
## redData$maxT_Q4 -1.305 0.192
## redData$maxT_Q2 -1.551 0.121
## redData$sample_year 0.993 0.321
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) rdDt$g_ rdD$_2 rD$_NU rdD$_S a.((D$ rD$T_Q4 rD$T_Q2
## redData$g_y 0.677
## rdDt$fd_gr2 -0.044 -0.100
## rdDt$f_NULL 0.105 0.116 0.370
## rdDt$gntc_S 0.090 0.089 -0.029 0.243
## as.n((D$_)) 0.156 -0.037 0.047 -0.033 0.070
## rdDt$mxT_Q4 0.145 -0.008 -0.001 0.058 0.006 0.046
## rdDt$mxT_Q2 -0.476 -0.149 -0.005 -0.079 -0.045 -0.146 -0.494
## rdDt$smpl_y -1.000 -0.678 0.044 -0.105 -0.090 -0.157 -0.148 0.474
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(yMaxSW_year)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## redData$age_y 0.50579 0.50579 1 1010 17.1441
## redData$feed_group 0.03623 0.01812 2 1010 0.6141
## redData$genetic_group 0.03860 0.03860 1 1010 1.3085
## as.numeric(paste(redData$sample_interval)) 0.00057 0.00057 1 1010 0.0193
## redData$maxT_Q4 0.05024 0.05024 1 1010 1.7029
## redData$maxT_Q2 0.07097 0.07097 1 1010 2.4056
## redData$sample_year 0.02907 0.02907 1 1010 0.9853
## Pr(>F)
## redData$age_y 3.754e-05 ***
## redData$feed_group 0.5413
## redData$genetic_group 0.2529
## as.numeric(paste(redData$sample_interval)) 0.8895
## redData$maxT_Q4 0.1922
## redData$maxT_Q2 0.1212
## redData$sample_year 0.3211
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(yMaxSW_year)
## [1] -603.0024
min temperature
#minT spring
min_t_sp <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
redData$age_y +
redData$feed_group +
redData$genetic_group +
as.numeric(paste(redData$sample_interval)) +
redData$minT_Q1 +
(1|redData$recoded_id),
na.action=na.exclude)
## boundary (singular) fit: see ?isSingular
summary(min_t_sp)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(redData$diff_rltl_res)) ~ redData$age_y + redData$feed_group +
## redData$genetic_group + as.numeric(paste(redData$sample_interval)) +
## redData$minT_Q1 + (1 | redData$recoded_id)
##
## REML criterion at convergence: -628.6
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.7556 -0.6973 0.0071 0.6713 3.2318
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 0.00000 0.0000
## Residual 0.02983 0.1727
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -9.711e-02 2.537e-02 1.012e+03
## redData$age_y 3.119e-02 4.808e-03 1.012e+03
## redData$feed_group2 -1.216e-02 1.212e-02 1.012e+03
## redData$feed_groupNULL -1.312e-02 1.546e-02 1.012e+03
## redData$genetic_groupS -1.239e-02 1.137e-02 1.012e+03
## as.numeric(paste(redData$sample_interval)) 3.023e-06 5.156e-05 1.012e+03
## redData$minT_Q1 2.580e-04 3.921e-03 1.012e+03
## t value Pr(>|t|)
## (Intercept) -3.828 0.000137 ***
## redData$age_y 6.489 1.35e-10 ***
## redData$feed_group2 -1.003 0.316142
## redData$feed_groupNULL -0.849 0.396340
## redData$genetic_groupS -1.090 0.276068
## as.numeric(paste(redData$sample_interval)) 0.059 0.953264
## redData$minT_Q1 0.066 0.947540
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) rdDt$_ rdD$_2 rD$_NU rdD$_S a.((D$
## redData$g_y -0.430
## rdDt$fd_gr2 -0.224 -0.094
## rdDt$f_NULL -0.235 0.074 0.376
## rdDt$gntc_S -0.296 0.054 -0.026 0.237
## as.n((D$_)) -0.726 -0.142 0.051 -0.052 0.058
## rdDt$mnT_Q1 0.412 -0.458 0.027 -0.021 -0.041 -0.044
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(min_t_sp)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## redData$age_y 1.25573 1.25573 1 1012 42.1015
## redData$feed_group 0.03772 0.01886 2 1012 0.6324
## redData$genetic_group 0.03542 0.03542 1 1012 1.1876
## as.numeric(paste(redData$sample_interval)) 0.00010 0.00010 1 1012 0.0034
## redData$minT_Q1 0.00013 0.00013 1 1012 0.0043
## Pr(>F)
## redData$age_y 1.354e-10 ***
## redData$feed_group 0.5315
## redData$genetic_group 0.2761
## as.numeric(paste(redData$sample_interval)) 0.9533
## redData$minT_Q1 0.9475
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(min_t_sp)
## [1] -610.5732
#summer
min_t_su <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
redData$age_y +
redData$feed_group +
redData$genetic_group +
as.numeric(paste(redData$sample_interval)) +
redData$minT_Q2 +
(1|redData$recoded_id),
na.action=na.exclude)
## boundary (singular) fit: see ?isSingular
summary(min_t_su)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(redData$diff_rltl_res)) ~ redData$age_y + redData$feed_group +
## redData$genetic_group + as.numeric(paste(redData$sample_interval)) +
## redData$minT_Q2 + (1 | redData$recoded_id)
##
## REML criterion at convergence: -629
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.7518 -0.7006 0.0088 0.6727 3.2342
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 0.00000 0.0000
## Residual 0.02982 0.1727
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -9.127e-02 2.879e-02 1.012e+03
## redData$age_y 3.065e-02 4.645e-03 1.012e+03
## redData$feed_group2 -1.212e-02 1.212e-02 1.012e+03
## redData$feed_groupNULL -1.365e-02 1.552e-02 1.012e+03
## redData$genetic_groupS -1.259e-02 1.137e-02 1.012e+03
## as.numeric(paste(redData$sample_interval)) 4.756e-07 5.200e-05 1.012e+03
## redData$minT_Q2 -1.719e-03 4.524e-03 1.012e+03
## t value Pr(>|t|)
## (Intercept) -3.170 0.00157 **
## redData$age_y 6.598 6.71e-11 ***
## redData$feed_group2 -1.000 0.31756
## redData$feed_groupNULL -0.880 0.37929
## redData$genetic_groupS -1.107 0.26860
## as.numeric(paste(redData$sample_interval)) 0.009 0.99270
## redData$minT_Q2 -0.380 0.70406
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) rdDt$_ rdD$_2 rD$_NU rdD$_S a.((D$
## redData$g_y -0.453
## rdDt$fd_gr2 -0.199 -0.090
## rdDt$f_NULL -0.255 0.104 0.374
## rdDt$gntc_S -0.278 0.058 -0.026 0.240
## as.n((D$_)) -0.700 -0.113 0.050 -0.039 0.063
## rdDt$mnT_Q2 -0.596 0.392 -0.013 0.095 0.054 0.137
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(min_t_su)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## redData$age_y 1.29828 1.29828 1 1012 43.5342
## redData$feed_group 0.03869 0.01935 2 1012 0.6487
## redData$genetic_group 0.03654 0.03654 1 1012 1.2252
## as.numeric(paste(redData$sample_interval)) 0.00000 0.00000 1 1012 0.0001
## redData$minT_Q2 0.00431 0.00431 1 1012 0.1444
## Pr(>F)
## redData$age_y 6.706e-11 ***
## redData$feed_group 0.5229
## redData$genetic_group 0.2686
## as.numeric(paste(redData$sample_interval)) 0.9927
## redData$minT_Q2 0.7041
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(min_t_su)
## [1] -610.9996
#autumn
min_t_au <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
redData$age_y +
redData$feed_group +
redData$genetic_group +
as.numeric(paste(redData$sample_interval)) +
redData$minT_Q3 +
(1|redData$recoded_id),
na.action=na.exclude)
## boundary (singular) fit: see ?isSingular
summary(min_t_au)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(redData$diff_rltl_res)) ~ redData$age_y + redData$feed_group +
## redData$genetic_group + as.numeric(paste(redData$sample_interval)) +
## redData$minT_Q3 + (1 | redData$recoded_id)
##
## REML criterion at convergence: -644.5
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.6175 -0.6816 0.0195 0.6763 3.4099
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 0.00000 0.0000
## Residual 0.02943 0.1716
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) 2.713e-01 1.028e-01 1.012e+03
## redData$age_y 2.734e-02 4.383e-03 1.012e+03
## redData$feed_group2 -1.082e-02 1.204e-02 1.012e+03
## redData$feed_groupNULL -1.423e-02 1.535e-02 1.012e+03
## redData$genetic_groupS -1.234e-02 1.128e-02 1.012e+03
## as.numeric(paste(redData$sample_interval)) 1.170e-05 5.122e-05 1.012e+03
## redData$minT_Q3 -4.891e-02 1.328e-02 1.012e+03
## t value Pr(>|t|)
## (Intercept) 2.639 0.008444 **
## redData$age_y 6.238 6.49e-10 ***
## redData$feed_group2 -0.899 0.369103
## redData$feed_groupNULL -0.927 0.354335
## redData$genetic_groupS -1.094 0.274236
## as.numeric(paste(redData$sample_interval)) 0.228 0.819391
## redData$minT_Q3 -3.683 0.000243 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) rdDt$_ rdD$_2 rD$_NU rdD$_S a.((D$
## redData$g_y -0.306
## rdDt$fd_gr2 -0.028 -0.096
## rdDt$f_NULL -0.075 0.075 0.376
## rdDt$gntc_S -0.068 0.039 -0.025 0.237
## as.n((D$_)) -0.129 -0.188 0.053 -0.054 0.057
## rdDt$mnT_Q3 -0.975 0.248 -0.031 0.020 0.000 -0.045
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(min_t_au)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## redData$age_y 1.14541 1.14541 1 1012 38.9172
## redData$feed_group 0.03565 0.01783 2 1012 0.6057
## redData$genetic_group 0.03522 0.03522 1 1012 1.1967
## as.numeric(paste(redData$sample_interval)) 0.00154 0.00154 1 1012 0.0522
## redData$minT_Q3 0.39924 0.39924 1 1012 13.5650
## Pr(>F)
## redData$age_y 6.488e-10 ***
## redData$feed_group 0.5459076
## redData$genetic_group 0.2742360
## as.numeric(paste(redData$sample_interval)) 0.8193906
## redData$minT_Q3 0.0002426 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(min_t_au)
## [1] -626.497
tableS16 <- as.data.frame(round(coef(summary(min_t_au)),3))
write.csv(tableS16, "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/tableS16.csv")
tableS17 <- as.data.frame(anova(min_t_au))
write.csv(tableS17, "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/tableS17.csv")
# min autumn & max summer
min_t_au_max_su <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
redData$age_y +
redData$feed_group +
redData$genetic_group +
as.numeric(paste(redData$sample_interval)) +
redData$minT_Q3 +
redData$maxT_Q2 +
(1|redData$recoded_id),
na.action=na.exclude)
## boundary (singular) fit: see ?isSingular
summary(min_t_au_max_su)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(redData$diff_rltl_res)) ~ redData$age_y + redData$feed_group +
## redData$genetic_group + as.numeric(paste(redData$sample_interval)) +
## redData$minT_Q3 + redData$maxT_Q2 + (1 | redData$recoded_id)
##
## REML criterion at convergence: -636.7
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.6145 -0.6817 0.0212 0.6765 3.4092
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 0.00000 0.0000
## Residual 0.02946 0.1716
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) 2.743e-01 1.255e-01 1.011e+03
## redData$age_y 2.734e-02 4.385e-03 1.011e+03
## redData$feed_group2 -1.082e-02 1.205e-02 1.011e+03
## redData$feed_groupNULL -1.427e-02 1.540e-02 1.011e+03
## redData$genetic_groupS -1.235e-02 1.129e-02 1.011e+03
## as.numeric(paste(redData$sample_interval)) 1.151e-05 5.146e-05 1.011e+03
## redData$minT_Q3 -5.001e-02 2.998e-02 1.011e+03
## redData$maxT_Q2 3.270e-04 7.946e-03 1.011e+03
## t value Pr(>|t|)
## (Intercept) 2.186 0.0290 *
## redData$age_y 6.235 6.61e-10 ***
## redData$feed_group2 -0.898 0.3692
## redData$feed_groupNULL -0.927 0.3543
## redData$genetic_groupS -1.094 0.2742
## as.numeric(paste(redData$sample_interval)) 0.224 0.8231
## redData$minT_Q3 -1.668 0.0955 .
## redData$maxT_Q2 0.041 0.9672
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) rdDt$_ rdD$_2 rD$_NU rdD$_S a.((D$ rD$T_Q3
## redData$g_y -0.249
## rdDt$fd_gr2 -0.026 -0.096
## rdDt$f_NULL -0.102 0.075 0.375
## rdDt$gntc_S -0.066 0.039 -0.025 0.237
## as.n((D$_)) -0.158 -0.188 0.053 -0.047 0.058
## rdDt$mnT_Q3 -0.867 0.107 -0.008 0.073 0.015 0.061
## rdDt$mxT_Q2 0.573 0.004 -0.006 -0.072 -0.017 -0.090 -0.896
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(min_t_au_max_su)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## redData$age_y 1.14545 1.14545 1 1011 38.8802
## redData$feed_group 0.03570 0.01785 2 1011 0.6058
## redData$genetic_group 0.03526 0.03526 1 1011 1.1967
## as.numeric(paste(redData$sample_interval)) 0.00147 0.00147 1 1011 0.0500
## redData$minT_Q3 0.08201 0.08201 1 1011 2.7837
## redData$maxT_Q2 0.00005 0.00005 1 1011 0.0017
## Pr(>F)
## redData$age_y 6.61e-10 ***
## redData$feed_group 0.54581
## redData$genetic_group 0.27423
## as.numeric(paste(redData$sample_interval)) 0.82310
## redData$minT_Q3 0.09554 .
## redData$maxT_Q2 0.96718
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(min_t_au_max_su)
## [1] -616.6658
tableS18<-as.data.frame(round(coef(summary(min_t_au_max_su)),3))
write.csv(tableS18, "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/tableS18.csv")
tableS19<-as.data.frame(anova(min_t_au_max_su))
write.csv(tableS19, "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/tableS19.csv")
#winter
min_t_wi <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
redData$age_y +
redData$feed_group +
redData$genetic_group +
as.numeric(paste(redData$sample_interval)) +
redData$minT_Q4 +
(1 | redData$recoded_id),
na.action = na.exclude)
## boundary (singular) fit: see ?isSingular
summary(min_t_wi)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(redData$diff_rltl_res)) ~ redData$age_y + redData$feed_group +
## redData$genetic_group + as.numeric(paste(redData$sample_interval)) +
## redData$minT_Q4 + (1 | redData$recoded_id)
##
## REML criterion at convergence: -630.6
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.7642 -0.6855 0.0232 0.6679 3.2393
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 0.00000 0.0000
## Residual 0.02973 0.1724
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -8.598e-02 2.403e-02 1.012e+03
## redData$age_y 2.825e-02 4.614e-03 1.012e+03
## redData$feed_group2 -1.151e-02 1.210e-02 1.012e+03
## redData$feed_groupNULL -1.244e-02 1.543e-02 1.012e+03
## redData$genetic_groupS -1.262e-02 1.134e-02 1.012e+03
## as.numeric(paste(redData$sample_interval)) 7.699e-06 5.150e-05 1.012e+03
## redData$minT_Q4 4.048e-03 2.294e-03 1.012e+03
## t value Pr(>|t|)
## (Intercept) -3.578 0.000362 ***
## redData$age_y 6.122 1.32e-09 ***
## redData$feed_group2 -0.951 0.341780
## redData$feed_groupNULL -0.806 0.420532
## redData$genetic_groupS -1.113 0.265938
## as.numeric(paste(redData$sample_interval)) 0.150 0.881183
## redData$minT_Q4 1.765 0.077879 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) rdDt$_ rdD$_2 rD$_NU rdD$_S a.((D$
## redData$g_y -0.370
## rdDt$fd_gr2 -0.239 -0.097
## rdDt$f_NULL -0.232 0.058 0.377
## rdDt$gntc_S -0.298 0.042 -0.026 0.236
## as.n((D$_)) -0.732 -0.188 0.053 -0.052 0.056
## rdDt$mnT_Q4 0.279 -0.380 0.031 0.024 -0.013 0.050
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(min_t_wi)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## redData$age_y 1.11450 1.11450 1 1012 37.4812
## redData$feed_group 0.03383 0.01691 2 1012 0.5688
## redData$genetic_group 0.03684 0.03684 1 1012 1.2389
## as.numeric(paste(redData$sample_interval)) 0.00066 0.00066 1 1012 0.0224
## redData$minT_Q4 0.09262 0.09262 1 1012 3.1149
## Pr(>F)
## redData$age_y 1.319e-09 ***
## redData$feed_group 0.56636
## redData$genetic_group 0.26594
## as.numeric(paste(redData$sample_interval)) 0.88118
## redData$minT_Q4 0.07788 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(min_t_wi)
## [1] -612.61
mean rain
# spring
r_sp <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
redData$age_y +
redData$feed_group +
redData$genetic_group +
as.numeric(paste(redData$sample_interval)) +
redData$mean_rain_Q1 +
(1 | redData$recoded_id),
na.action = na.exclude)
## boundary (singular) fit: see ?isSingular
summary(r_sp)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(redData$diff_rltl_res)) ~ redData$age_y + redData$feed_group +
## redData$genetic_group + as.numeric(paste(redData$sample_interval)) +
## redData$mean_rain_Q1 + (1 | redData$recoded_id)
##
## REML criterion at convergence: -623.5
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.8068 -0.7032 0.0095 0.6709 3.1926
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 0.00000 0.0000
## Residual 0.02976 0.1725
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -8.613e-02 2.440e-02 1.012e+03
## redData$age_y 3.413e-02 4.669e-03 1.012e+03
## redData$feed_group2 -1.233e-02 1.210e-02 1.012e+03
## redData$feed_groupNULL -1.129e-02 1.549e-02 1.012e+03
## redData$genetic_groupS -1.133e-02 1.137e-02 1.012e+03
## as.numeric(paste(redData$sample_interval)) 1.486e-05 5.206e-05 1.012e+03
## redData$mean_rain_Q1 -1.511e-04 1.024e-04 1.012e+03
## t value Pr(>|t|)
## (Intercept) -3.529 0.000435 ***
## redData$age_y 7.309 5.45e-13 ***
## redData$feed_group2 -1.019 0.308643
## redData$feed_groupNULL -0.729 0.466209
## redData$genetic_groupS -0.997 0.319101
## as.numeric(paste(redData$sample_interval)) 0.285 0.775413
## redData$mean_rain_Q1 -1.475 0.140445
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) rdDt$_ rdD$_2 rD$_NU rdD$_S a.((D$
## redData$g_y -0.126
## rdDt$fd_gr2 -0.247 -0.087
## rdDt$f_NULL -0.209 0.098 0.375
## rdDt$gntc_S -0.270 0.061 -0.026 0.240
## as.n((D$_)) -0.678 -0.104 0.050 -0.040 0.065
## rdDt$mn__Q1 -0.324 -0.405 0.008 -0.079 -0.061 -0.152
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(r_sp)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## redData$age_y 1.59006 1.59006 1 1012 53.4251
## redData$feed_group 0.03505 0.01753 2 1012 0.5889
## redData$genetic_group 0.02957 0.02957 1 1012 0.9936
## as.numeric(paste(redData$sample_interval)) 0.00242 0.00242 1 1012 0.0814
## redData$mean_rain_Q1 0.06478 0.06478 1 1012 2.1765
## Pr(>F)
## redData$age_y 5.446e-13 ***
## redData$feed_group 0.5551
## redData$genetic_group 0.3191
## as.numeric(paste(redData$sample_interval)) 0.7754
## redData$mean_rain_Q1 0.1404
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(r_sp)
## [1] -605.456
# summer
r_su <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
redData$age_y +
redData$feed_group +
redData$genetic_group +
as.numeric(paste(redData$sample_interval)) +
redData$mean_rain_Q2 +
(1 | redData$recoded_id),
na.action = na.exclude)
## boundary (singular) fit: see ?isSingular
summary(r_su)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(redData$diff_rltl_res)) ~ redData$age_y + redData$feed_group +
## redData$genetic_group + as.numeric(paste(redData$sample_interval)) +
## redData$mean_rain_Q2 + (1 | redData$recoded_id)
##
## REML criterion at convergence: -626.4
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.7692 -0.6823 0.0235 0.6660 3.2388
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 0.0000 0.0000
## Residual 0.0297 0.1723
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -1.342e-01 2.909e-02 1.012e+03
## redData$age_y 2.871e-02 4.454e-03 1.012e+03
## redData$feed_group2 -1.149e-02 1.210e-02 1.012e+03
## redData$feed_groupNULL -1.208e-02 1.543e-02 1.012e+03
## redData$genetic_groupS -1.239e-02 1.133e-02 1.012e+03
## as.numeric(paste(redData$sample_interval)) 1.071e-05 5.154e-05 1.012e+03
## redData$mean_rain_Q2 3.329e-04 1.623e-04 1.012e+03
## t value Pr(>|t|)
## (Intercept) -4.612 4.50e-06 ***
## redData$age_y 6.446 1.77e-10 ***
## redData$feed_group2 -0.950 0.3425
## redData$feed_groupNULL -0.783 0.4338
## redData$genetic_groupS -1.093 0.2746
## as.numeric(paste(redData$sample_interval)) 0.208 0.8354
## redData$mean_rain_Q2 2.051 0.0405 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) rdDt$_ rdD$_2 rD$_NU rdD$_S a.((D$
## redData$g_y -0.050
## rdDt$fd_gr2 -0.222 -0.096
## rdDt$f_NULL -0.217 0.060 0.377
## rdDt$gntc_S -0.242 0.039 -0.025 0.236
## as.n((D$_)) -0.659 -0.195 0.054 -0.051 0.057
## rdDt$mn__Q2 -0.610 -0.288 0.028 0.032 -0.001 0.071
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(r_su)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## redData$age_y 1.23429 1.23429 1 1012 41.5544
## redData$feed_group 0.03304 0.01652 2 1012 0.5562
## redData$genetic_group 0.03549 0.03549 1 1012 1.1948
## as.numeric(paste(redData$sample_interval)) 0.00128 0.00128 1 1012 0.0432
## redData$mean_rain_Q2 0.12497 0.12497 1 1012 4.2074
## Pr(>F)
## redData$age_y 1.771e-10 ***
## redData$feed_group 0.57357
## redData$genetic_group 0.27462
## as.numeric(paste(redData$sample_interval)) 0.83537
## redData$mean_rain_Q2 0.04051 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(r_su)
## [1] -608.4028
tableS20 <- as.data.frame(round(coef(summary(r_su)), 3))
write.csv(tableS20, "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/tableS20.csv")
tableS21 <- as.data.frame(anova(r_su))
write.csv(tableS21, "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/tableS21.csv")
# autumn
r_au <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
redData$age_y +
redData$feed_group +
redData$genetic_group +
as.numeric(paste(redData$sample_interval)) +
redData$mean_rain_Q3 +
(1 | redData$recoded_id), na.action = na.exclude)
## boundary (singular) fit: see ?isSingular
summary(r_au)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(redData$diff_rltl_res)) ~ redData$age_y + redData$feed_group +
## redData$genetic_group + as.numeric(paste(redData$sample_interval)) +
## redData$mean_rain_Q3 + (1 | redData$recoded_id)
##
## REML criterion at convergence: -622.5
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.7671 -0.7007 0.0110 0.6702 3.2207
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 0.00000 0.0000
## Residual 0.02983 0.1727
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -1.036e-01 4.676e-02 1.012e+03
## redData$age_y 3.171e-02 5.006e-03 1.012e+03
## redData$feed_group2 -1.222e-02 1.212e-02 1.012e+03
## redData$feed_groupNULL -1.294e-02 1.549e-02 1.012e+03
## redData$genetic_groupS -1.226e-02 1.138e-02 1.012e+03
## as.numeric(paste(redData$sample_interval)) 4.038e-06 5.187e-05 1.012e+03
## redData$mean_rain_Q3 2.664e-05 1.865e-04 1.012e+03
## t value Pr(>|t|)
## (Intercept) -2.215 0.027 *
## redData$age_y 6.334 3.58e-10 ***
## redData$feed_group2 -1.008 0.313
## redData$feed_groupNULL -0.835 0.404
## redData$genetic_groupS -1.077 0.282
## as.numeric(paste(redData$sample_interval)) 0.078 0.938
## redData$mean_rain_Q3 0.143 0.886
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) rdDt$_ rdD$_2 rD$_NU rdD$_S a.((D$
## redData$g_y -0.578
## rdDt$fd_gr2 -0.105 -0.092
## rdDt$f_NULL -0.184 0.099 0.374
## rdDt$gntc_S -0.205 0.066 -0.027 0.240
## as.n((D$_)) -0.483 -0.094 0.048 -0.044 0.063
## rdDt$mn__Q3 -0.869 0.521 -0.026 0.071 0.062 0.117
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(r_au)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## redData$age_y 1.19669 1.19669 1 1012 40.1227
## redData$feed_group 0.03761 0.01881 2 1012 0.6305
## redData$genetic_group 0.03460 0.03460 1 1012 1.1602
## as.numeric(paste(redData$sample_interval)) 0.00018 0.00018 1 1012 0.0061
## redData$mean_rain_Q3 0.00061 0.00061 1 1012 0.0204
## Pr(>F)
## redData$age_y 3.582e-10 ***
## redData$feed_group 0.5325
## redData$genetic_group 0.2817
## as.numeric(paste(redData$sample_interval)) 0.9380
## redData$mean_rain_Q3 0.8865
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(r_au)
## [1] -604.4984
# winter
r_wi <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
redData$age_y +
redData$feed_group +
redData$genetic_group +
as.numeric(paste(redData$sample_interval)) +
redData$mean_rain_Q4 +
(1 | redData$recoded_id),
na.action = na.exclude)
## boundary (singular) fit: see ?isSingular
summary(r_wi)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(redData$diff_rltl_res)) ~ redData$age_y + redData$feed_group +
## redData$genetic_group + as.numeric(paste(redData$sample_interval)) +
## redData$mean_rain_Q4 + (1 | redData$recoded_id)
##
## REML criterion at convergence: -622.2
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.7762 -0.7014 0.0090 0.6741 3.2152
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 0.00000 0.0000
## Residual 0.02981 0.1727
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -1.142e-01 3.463e-02 1.012e+03
## redData$age_y 3.033e-02 4.562e-03 1.012e+03
## redData$feed_group2 -1.200e-02 1.212e-02 1.012e+03
## redData$feed_groupNULL -1.278e-02 1.546e-02 1.012e+03
## redData$genetic_groupS -1.248e-02 1.136e-02 1.012e+03
## as.numeric(paste(redData$sample_interval)) 4.304e-06 5.153e-05 1.012e+03
## redData$mean_rain_Q4 8.479e-05 1.336e-04 1.012e+03
## t value Pr(>|t|)
## (Intercept) -3.296 0.00101 **
## redData$age_y 6.648 4.86e-11 ***
## redData$feed_group2 -0.990 0.32223
## redData$feed_groupNULL -0.826 0.40874
## redData$genetic_groupS -1.099 0.27219
## as.numeric(paste(redData$sample_interval)) 0.084 0.93345
## redData$mean_rain_Q4 0.635 0.52580
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) rdDt$_ rdD$_2 rD$_NU rdD$_S a.((D$
## redData$g_y 0.075
## rdDt$fd_gr2 -0.189 -0.094
## rdDt$f_NULL -0.190 0.057 0.377
## rdDt$gntc_S -0.192 0.043 -0.026 0.236
## as.n((D$_)) -0.545 -0.183 0.053 -0.052 0.056
## rdDt$mn__Q4 -0.745 -0.350 0.023 0.032 -0.017 0.035
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(r_wi)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## redData$age_y 1.31752 1.31752 1 1012 44.1906
## redData$feed_group 0.03637 0.01819 2 1012 0.6100
## redData$genetic_group 0.03599 0.03599 1 1012 1.2070
## as.numeric(paste(redData$sample_interval)) 0.00021 0.00021 1 1012 0.0070
## redData$mean_rain_Q4 0.01201 0.01201 1 1012 0.4028
## Pr(>F)
## redData$age_y 4.863e-11 ***
## redData$feed_group 0.5435
## redData$genetic_group 0.2722
## as.numeric(paste(redData$sample_interval)) 0.9334
## redData$mean_rain_Q4 0.5258
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(r_wi)
## [1] -604.2137
Mean sun hours
# spring
sh_sp <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
redData$age_y +
redData$feed_group +
redData$genetic_group +
as.numeric(paste(redData$sample_interval)) +
redData$mean_sun_hours_Q1 +
(1 | redData$recoded_id),
na.action = na.exclude)
## boundary (singular) fit: see ?isSingular
summary(sh_sp)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(redData$diff_rltl_res)) ~ redData$age_y + redData$feed_group +
## redData$genetic_group + as.numeric(paste(redData$sample_interval)) +
## redData$mean_sun_hours_Q1 + (1 | redData$recoded_id)
##
## REML criterion at convergence: -625.8
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.7673 -0.7073 0.0156 0.6649 3.2293
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 0.00000 0.0000
## Residual 0.02978 0.1726
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -1.418e-01 4.371e-02 1.012e+03
## redData$age_y 3.412e-02 4.872e-03 1.012e+03
## redData$feed_group2 -1.234e-02 1.211e-02 1.012e+03
## redData$feed_groupNULL -1.136e-02 1.551e-02 1.012e+03
## redData$genetic_groupS -1.137e-02 1.138e-02 1.012e+03
## as.numeric(paste(redData$sample_interval)) 1.406e-05 5.229e-05 1.012e+03
## redData$mean_sun_hours_Q1 5.850e-04 4.929e-04 1.012e+03
## t value Pr(>|t|)
## (Intercept) -3.245 0.00121 **
## redData$age_y 7.003 4.56e-12 ***
## redData$feed_group2 -1.019 0.30841
## redData$feed_groupNULL -0.732 0.46422
## redData$genetic_groupS -0.999 0.31780
## as.numeric(paste(redData$sample_interval)) 0.269 0.78810
## redData$mean_sun_hours_Q1 1.187 0.23555
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) rdDt$_ rdD$_2 rD$_NU rdD$_S a.((D$
## redData$g_y -0.546
## rdDt$fd_gr2 -0.127 -0.086
## rdDt$f_NULL -0.211 0.109 0.374
## rdDt$gntc_S -0.223 0.070 -0.026 0.242
## as.n((D$_)) -0.554 -0.073 0.049 -0.036 0.069
## rdDt$m___Q1 -0.849 0.481 -0.011 0.094 0.073 0.175
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(sh_sp)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## redData$age_y 1.46073 1.46073 1 1012 49.0424
## redData$feed_group 0.03520 0.01760 2 1012 0.5909
## redData$genetic_group 0.02975 0.02975 1 1012 0.9990
## as.numeric(paste(redData$sample_interval)) 0.00215 0.00215 1 1012 0.0723
## redData$mean_sun_hours_Q1 0.04196 0.04196 1 1012 1.4087
## Pr(>F)
## redData$age_y 4.56e-12 ***
## redData$feed_group 0.5540
## redData$genetic_group 0.3178
## as.numeric(paste(redData$sample_interval)) 0.7881
## redData$mean_sun_hours_Q1 0.2355
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(sh_sp)
## [1] -607.8305
# summer
sh_su <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
redData$age_y +
redData$feed_group +
redData$genetic_group +
as.numeric(paste(redData$sample_interval)) +
redData$mean_sun_hours_Q2 +
(1 | redData$recoded_id),
na.action = na.exclude)
## boundary (singular) fit: see ?isSingular
summary(sh_su)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(redData$diff_rltl_res)) ~ redData$age_y + redData$feed_group +
## redData$genetic_group + as.numeric(paste(redData$sample_interval)) +
## redData$mean_sun_hours_Q2 + (1 | redData$recoded_id)
##
## REML criterion at convergence: -629.7
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.7213 -0.6709 0.0219 0.6667 3.2782
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 0.00000 0.0000
## Residual 0.02967 0.1723
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) 5.951e-02 7.193e-02 1.012e+03
## redData$age_y 2.485e-02 5.105e-03 1.012e+03
## redData$feed_group2 -1.115e-02 1.209e-02 1.012e+03
## redData$feed_groupNULL -1.553e-02 1.545e-02 1.012e+03
## redData$genetic_groupS -1.372e-02 1.134e-02 1.012e+03
## as.numeric(paste(redData$sample_interval)) -5.398e-06 5.151e-05 1.012e+03
## redData$mean_sun_hours_Q2 -1.104e-03 4.784e-04 1.012e+03
## t value Pr(>|t|)
## (Intercept) 0.827 0.4082
## redData$age_y 4.868 1.31e-06 ***
## redData$feed_group2 -0.922 0.3568
## redData$feed_groupNULL -1.005 0.3149
## redData$genetic_groupS -1.210 0.2267
## as.numeric(paste(redData$sample_interval)) -0.105 0.9166
## redData$mean_sun_hours_Q2 -2.309 0.0212 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) rdDt$_ rdD$_2 rD$_NU rdD$_S a.((D$
## redData$g_y -0.601
## rdDt$fd_gr2 -0.048 -0.097
## rdDt$f_NULL -0.144 0.098 0.373
## rdDt$gntc_S -0.147 0.062 -0.027 0.239
## as.n((D$_)) -0.317 -0.113 0.049 -0.048 0.060
## rdDt$m___Q2 -0.947 0.550 -0.037 0.068 0.052 0.072
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(sh_su)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## redData$age_y 0.70314 0.70314 1 1012 23.6984
## redData$feed_group 0.04030 0.02015 2 1012 0.6792
## redData$genetic_group 0.04341 0.04341 1 1012 1.4629
## as.numeric(paste(redData$sample_interval)) 0.00033 0.00033 1 1012 0.0110
## redData$mean_sun_hours_Q2 0.15816 0.15816 1 1012 5.3307
## Pr(>F)
## redData$age_y 1.306e-06 ***
## redData$feed_group 0.50726
## redData$genetic_group 0.22674
## as.numeric(paste(redData$sample_interval)) 0.91656
## redData$mean_sun_hours_Q2 0.02115 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(sh_su)
## [1] -611.6836
tableS22 <- as.data.frame(round(coef(summary(sh_su)), 3))
write.csv(tableS22, "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/tableS22.csv")
tableS23 <- as.data.frame(anova(sh_su))
write.csv(tableS23, "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/tableS23.csv")
# autumn
sh_au <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
redData$age_y +
redData$feed_group +
redData$genetic_group +
as.numeric(paste(redData$sample_interval)) +
redData$mean_sun_hours_Q3 +
(1 | redData$recoded_id),
na.action = na.exclude)
## boundary (singular) fit: see ?isSingular
summary(sh_au)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(redData$diff_rltl_res)) ~ redData$age_y + redData$feed_group +
## redData$genetic_group + as.numeric(paste(redData$sample_interval)) +
## redData$mean_sun_hours_Q3 + (1 | redData$recoded_id)
##
## REML criterion at convergence: -626.2
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.7835 -0.7088 0.0121 0.6749 3.2061
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 0.0000 0.0000
## Residual 0.0298 0.1726
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -3.283e-02 6.771e-02 1.012e+03
## redData$age_y 3.321e-02 4.649e-03 1.012e+03
## redData$feed_group2 -1.238e-02 1.211e-02 1.012e+03
## redData$feed_groupNULL -1.285e-02 1.545e-02 1.012e+03
## redData$genetic_groupS -1.188e-02 1.136e-02 1.012e+03
## as.numeric(paste(redData$sample_interval)) 6.253e-06 5.158e-05 1.012e+03
## redData$mean_sun_hours_Q3 -7.300e-04 7.151e-04 1.012e+03
## t value Pr(>|t|)
## (Intercept) -0.485 0.628
## redData$age_y 7.144 1.74e-12 ***
## redData$feed_group2 -1.022 0.307
## redData$feed_groupNULL -0.832 0.406
## redData$genetic_groupS -1.046 0.296
## as.numeric(paste(redData$sample_interval)) 0.121 0.904
## redData$mean_sun_hours_Q3 -1.021 0.308
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) rdDt$_ rdD$_2 rD$_NU rdD$_S a.((D$
## redData$g_y 0.278
## rdDt$fd_gr2 -0.104 -0.091
## rdDt$f_NULL -0.071 0.073 0.376
## rdDt$gntc_S -0.066 0.053 -0.026 0.237
## as.n((D$_)) -0.210 -0.145 0.051 -0.052 0.059
## rdDt$m___Q3 -0.940 -0.394 0.017 -0.015 -0.041 -0.059
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(sh_au)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## redData$age_y 1.52048 1.52048 1 1012 51.0302
## redData$feed_group 0.03809 0.01905 2 1012 0.6393
## redData$genetic_group 0.03260 0.03260 1 1012 1.0940
## as.numeric(paste(redData$sample_interval)) 0.00044 0.00044 1 1012 0.0147
## redData$mean_sun_hours_Q3 0.03105 0.03105 1 1012 1.0420
## Pr(>F)
## redData$age_y 1.737e-12 ***
## redData$feed_group 0.5279
## redData$genetic_group 0.2958
## as.numeric(paste(redData$sample_interval)) 0.9035
## redData$mean_sun_hours_Q3 0.3076
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(sh_au)
## [1] -608.2083
# winter
sh_wi <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
redData$age_y +
redData$feed_group +
redData$genetic_group +
as.numeric(paste(redData$sample_interval)) +
redData$mean_sun_hours_Q4 +
(1 | redData$recoded_id), na.action = na.exclude)
## boundary (singular) fit: see ?isSingular
summary(sh_wi)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(redData$diff_rltl_res)) ~ redData$age_y + redData$feed_group +
## redData$genetic_group + as.numeric(paste(redData$sample_interval)) +
## redData$mean_sun_hours_Q4 + (1 | redData$recoded_id)
##
## REML criterion at convergence: -624.2
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.7527 -0.7024 0.0083 0.6710 3.2336
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 0.00000 0.0000
## Residual 0.02982 0.1727
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -1.027e-01 3.055e-02 1.012e+03
## redData$age_y 3.147e-02 4.308e-03 1.012e+03
## redData$feed_group2 -1.221e-02 1.212e-02 1.012e+03
## redData$feed_groupNULL -1.332e-02 1.548e-02 1.012e+03
## redData$genetic_groupS -1.237e-02 1.136e-02 1.012e+03
## as.numeric(paste(redData$sample_interval)) 2.360e-06 5.162e-05 1.012e+03
## redData$mean_sun_hours_Q4 1.048e-04 4.262e-04 1.012e+03
## t value Pr(>|t|)
## (Intercept) -3.362 0.000802 ***
## redData$age_y 7.306 5.58e-13 ***
## redData$feed_group2 -1.007 0.313945
## redData$feed_groupNULL -0.860 0.389808
## redData$genetic_groupS -1.089 0.276449
## as.numeric(paste(redData$sample_interval)) 0.046 0.963539
## redData$mean_sun_hours_Q4 0.246 0.805841
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) rdDt$_ rdD$_2 rD$_NU rdD$_S a.((D$
## redData$g_y -0.305
## rdDt$fd_gr2 -0.189 -0.092
## rdDt$f_NULL -0.150 0.065 0.377
## rdDt$gntc_S -0.230 0.039 -0.025 0.236
## as.n((D$_)) -0.546 -0.189 0.052 -0.049 0.057
## rdDt$m___Q4 -0.654 0.124 -0.010 -0.059 -0.004 -0.064
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(sh_wi)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## redData$age_y 1.59194 1.59194 1 1012 53.3768
## redData$feed_group 0.03831 0.01916 2 1012 0.6423
## redData$genetic_group 0.03536 0.03536 1 1012 1.1857
## as.numeric(paste(redData$sample_interval)) 0.00006 0.00006 1 1012 0.0021
## redData$mean_sun_hours_Q4 0.00180 0.00180 1 1012 0.0604
## Pr(>F)
## redData$age_y 5.575e-13 ***
## redData$feed_group 0.5263
## redData$genetic_group 0.2764
## as.numeric(paste(redData$sample_interval)) 0.9635
## redData$mean_sun_hours_Q4 0.8058
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(sh_wi)
## [1] -606.1913
Air Frost
# spring
sp_af_sp <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
redData$age_y +
redData$feed_group +
redData$genetic_group +
as.numeric(paste(redData$sample_interval)) +
redData$sum_airFrost_days_Q1 +
(1 | redData$recoded_id), na.action = na.exclude)
## boundary (singular) fit: see ?isSingular
summary(sp_af_sp)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(redData$diff_rltl_res)) ~ redData$age_y + redData$feed_group +
## redData$genetic_group + as.numeric(paste(redData$sample_interval)) +
## redData$sum_airFrost_days_Q1 + (1 | redData$recoded_id)
##
## REML criterion at convergence: -625.3
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.7992 -0.7015 0.0145 0.6820 3.1925
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 0.00000 0.0000
## Residual 0.02979 0.1726
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -1.223e-01 3.104e-02 1.012e+03
## redData$age_y 3.268e-02 4.420e-03 1.012e+03
## redData$feed_group2 -1.230e-02 1.211e-02 1.012e+03
## redData$feed_groupNULL -1.279e-02 1.545e-02 1.012e+03
## redData$genetic_groupS -1.196e-02 1.135e-02 1.012e+03
## as.numeric(paste(redData$sample_interval)) 6.478e-06 5.155e-05 1.012e+03
## redData$sum_airFrost_days_Q1 4.594e-04 3.885e-04 1.012e+03
## t value Pr(>|t|)
## (Intercept) -3.941 8.67e-05 ***
## redData$age_y 7.395 2.97e-13 ***
## redData$feed_group2 -1.016 0.310
## redData$feed_groupNULL -0.828 0.408
## redData$genetic_groupS -1.053 0.292
## as.numeric(paste(redData$sample_interval)) 0.126 0.900
## redData$sum_airFrost_days_Q1 1.182 0.237
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) rdDt$_ rdD$_2 rD$_NU rdD$_S a.((D$
## redData$g_y -0.386
## rdDt$fd_gr2 -0.187 -0.091
## rdDt$f_NULL -0.196 0.074 0.376
## rdDt$gntc_S -0.248 0.046 -0.025 0.237
## as.n((D$_)) -0.614 -0.162 0.051 -0.052 0.058
## rdDt$_F__Q1 -0.668 0.257 -0.008 0.017 0.030 0.054
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(sp_af_sp)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## redData$age_y 1.62864 1.62864 1 1012 54.6795
## redData$feed_group 0.03763 0.01881 2 1012 0.6316
## redData$genetic_group 0.03304 0.03304 1 1012 1.1094
## as.numeric(paste(redData$sample_interval)) 0.00047 0.00047 1 1012 0.0158
## redData$sum_airFrost_days_Q1 0.04165 0.04165 1 1012 1.3983
## Pr(>F)
## redData$age_y 2.971e-13 ***
## redData$feed_group 0.5319
## redData$genetic_group 0.2925
## as.numeric(paste(redData$sample_interval)) 0.9000
## redData$sum_airFrost_days_Q1 0.2373
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(sp_af_sp)
## [1] -607.344
# summer
su_af_sp <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
redData$age_y +
redData$feed_group +
redData$genetic_group +
as.numeric(paste(redData$sample_interval)) +
redData$sum_airFrost_days_Q2 +
(1 | redData$recoded_id),
na.action = na.exclude)
## boundary (singular) fit: see ?isSingular
summary(su_af_sp)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(redData$diff_rltl_res)) ~ redData$age_y + redData$feed_group +
## redData$genetic_group + as.numeric(paste(redData$sample_interval)) +
## redData$sum_airFrost_days_Q2 + (1 | redData$recoded_id)
##
## REML criterion at convergence: -626.4
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.7529 -0.6977 0.0072 0.6732 3.2338
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 0.00000 0.0000
## Residual 0.02983 0.1727
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -9.882e-02 2.424e-02 1.012e+03
## redData$age_y 3.100e-02 4.895e-03 1.012e+03
## redData$feed_group2 -1.215e-02 1.212e-02 1.012e+03
## redData$feed_groupNULL -1.333e-02 1.554e-02 1.012e+03
## redData$genetic_groupS -1.246e-02 1.138e-02 1.012e+03
## as.numeric(paste(redData$sample_interval)) 1.986e-06 5.220e-05 1.012e+03
## redData$sum_airFrost_days_Q2 1.891e-04 1.345e-03 1.012e+03
## t value Pr(>|t|)
## (Intercept) -4.077 4.92e-05 ***
## redData$age_y 6.334 3.58e-10 ***
## redData$feed_group2 -1.002 0.316
## redData$feed_groupNULL -0.858 0.391
## redData$genetic_groupS -1.095 0.274
## as.numeric(paste(redData$sample_interval)) 0.038 0.970
## redData$sum_airFrost_days_Q2 0.141 0.888
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) rdDt$_ rdD$_2 rD$_NU rdD$_S a.((D$
## redData$g_y -0.101
## rdDt$fd_gr2 -0.252 -0.089
## rdDt$f_NULL -0.203 0.116 0.372
## rdDt$gntc_S -0.271 0.068 -0.026 0.242
## as.n((D$_)) -0.683 -0.079 0.048 -0.035 0.067
## rdDt$_F__Q2 -0.301 -0.487 0.019 -0.108 -0.067 -0.162
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(su_af_sp)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## redData$age_y 1.19672 1.19672 1 1012 40.1236
## redData$feed_group 0.03808 0.01904 2 1012 0.6384
## redData$genetic_group 0.03576 0.03576 1 1012 1.1990
## as.numeric(paste(redData$sample_interval)) 0.00004 0.00004 1 1012 0.0014
## redData$sum_airFrost_days_Q2 0.00059 0.00059 1 1012 0.0198
## Pr(>F)
## redData$age_y 3.58e-10 ***
## redData$feed_group 0.5283
## redData$genetic_group 0.2738
## as.numeric(paste(redData$sample_interval)) 0.9697
## redData$sum_airFrost_days_Q2 0.8883
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(su_af_sp)
## [1] -608.4493
# autumn
au_af_sp <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
redData$age_y +
redData$feed_group +
redData$genetic_group +
as.numeric(paste(redData$sample_interval)) +
redData$sum_airFrost_days_Q3 +
(1 | redData$recoded_id),
na.action = na.exclude)
## boundary (singular) fit: see ?isSingular
summary(au_af_sp)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(redData$diff_rltl_res)) ~ redData$age_y + redData$feed_group +
## redData$genetic_group + as.numeric(paste(redData$sample_interval)) +
## redData$sum_airFrost_days_Q3 + (1 | redData$recoded_id)
##
## REML criterion at convergence: -633.1
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.7572 -0.7028 0.0207 0.6639 3.2397
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 0.0000 0.0000
## Residual 0.0297 0.1723
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -1.088e-01 2.366e-02 1.012e+03
## redData$age_y 3.166e-02 4.268e-03 1.012e+03
## redData$feed_group2 -1.204e-02 1.209e-02 1.012e+03
## redData$feed_groupNULL -1.383e-02 1.542e-02 1.012e+03
## redData$genetic_groupS -1.213e-02 1.133e-02 1.012e+03
## as.numeric(paste(redData$sample_interval)) 4.813e-06 5.141e-05 1.012e+03
## redData$sum_airFrost_days_Q3 9.125e-03 4.374e-03 1.012e+03
## t value Pr(>|t|)
## (Intercept) -4.600 4.77e-06 ***
## redData$age_y 7.419 2.50e-13 ***
## redData$feed_group2 -0.996 0.3195
## redData$feed_groupNULL -0.897 0.3701
## redData$genetic_groupS -1.070 0.2847
## as.numeric(paste(redData$sample_interval)) 0.094 0.9254
## redData$sum_airFrost_days_Q3 2.086 0.0372 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) rdDt$_ rdD$_2 rD$_NU rdD$_S a.((D$
## redData$g_y -0.298
## rdDt$fd_gr2 -0.253 -0.091
## rdDt$f_NULL -0.237 0.072 0.376
## rdDt$gntc_S -0.301 0.040 -0.025 0.236
## as.n((D$_)) -0.762 -0.182 0.052 -0.053 0.057
## rdDt$_F__Q3 -0.224 0.036 0.005 -0.023 0.009 0.015
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(au_af_sp)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## redData$age_y 1.63465 1.63465 1 1012 55.0413
## redData$feed_group 0.03888 0.01944 2 1012 0.6545
## redData$genetic_group 0.03403 0.03403 1 1012 1.1459
## as.numeric(paste(redData$sample_interval)) 0.00026 0.00026 1 1012 0.0088
## redData$sum_airFrost_days_Q3 0.12927 0.12927 1 1012 4.3529
## Pr(>F)
## redData$age_y 2.495e-13 ***
## redData$feed_group 0.5199
## redData$genetic_group 0.2847
## as.numeric(paste(redData$sample_interval)) 0.9254
## redData$sum_airFrost_days_Q3 0.0372 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(au_af_sp)
## [1] -615.1354
tableS24 <- as.data.frame(round(coef(summary(au_af_sp)), 3))
write.csv(tableS24, "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/tableS24.csv")
tableS25 <- as.data.frame(anova(au_af_sp))
write.csv(tableS25, "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/tableS25.csv")
# winter
wi_af_sp <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
redData$age_y +
redData$feed_group +
redData$genetic_group +
as.numeric(paste(redData$sample_interval)) +
redData$sum_airFrost_days_Q4 +
(1 | redData$recoded_id),
na.action = na.exclude)
## boundary (singular) fit: see ?isSingular
summary(wi_af_sp)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(redData$diff_rltl_res)) ~ redData$age_y + redData$feed_group +
## redData$genetic_group + as.numeric(paste(redData$sample_interval)) +
## redData$sum_airFrost_days_Q4 + (1 | redData$recoded_id)
##
## REML criterion at convergence: -624.5
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.7568 -0.7014 0.0075 0.6697 3.2300
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 0.00000 0.0000
## Residual 0.02983 0.1727
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -1.005e-01 2.915e-02 1.012e+03
## redData$age_y 3.152e-02 4.438e-03 1.012e+03
## redData$feed_group2 -1.221e-02 1.212e-02 1.012e+03
## redData$feed_groupNULL -1.319e-02 1.547e-02 1.012e+03
## redData$genetic_groupS -1.234e-02 1.136e-02 1.012e+03
## as.numeric(paste(redData$sample_interval)) 2.889e-06 5.155e-05 1.012e+03
## redData$sum_airFrost_days_Q4 7.905e-05 5.171e-04 1.012e+03
## t value Pr(>|t|)
## (Intercept) -3.448 0.000587 ***
## redData$age_y 7.103 2.29e-12 ***
## redData$feed_group2 -1.007 0.313937
## redData$feed_groupNULL -0.853 0.393961
## redData$genetic_groupS -1.086 0.277655
## as.numeric(paste(redData$sample_interval)) 0.056 0.955313
## redData$sum_airFrost_days_Q4 0.153 0.878525
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) rdDt$_ rdD$_2 rD$_NU rdD$_S a.((D$
## redData$g_y -0.391
## rdDt$fd_gr2 -0.194 -0.093
## rdDt$f_NULL -0.173 0.059 0.377
## rdDt$gntc_S -0.250 0.042 -0.025 0.236
## as.n((D$_)) -0.595 -0.186 0.052 -0.052 0.056
## rdDt$_F__Q4 -0.609 0.269 -0.017 -0.040 0.011 -0.036
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(wi_af_sp)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## redData$age_y 1.50490 1.50490 1 1012 50.4566
## redData$feed_group 0.03805 0.01903 2 1012 0.6379
## redData$genetic_group 0.03519 0.03519 1 1012 1.1798
## as.numeric(paste(redData$sample_interval)) 0.00009 0.00009 1 1012 0.0031
## redData$sum_airFrost_days_Q4 0.00070 0.00070 1 1012 0.0234
## Pr(>F)
## redData$age_y 2.294e-12 ***
## redData$feed_group 0.5286
## redData$genetic_group 0.2777
## as.numeric(paste(redData$sample_interval)) 0.9553
## redData$sum_airFrost_days_Q4 0.8785
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(wi_af_sp)
## [1] -606.5407
shapiro.test(init_change_dat$ResDiff)
##
## Shapiro-Wilk normality test
##
## data: init_change_dat$ResDiff
## W = 0.99401, p-value = 0.3057
ks.test(init_change_dat$ResDiff, pnorm)
##
## One-sample Kolmogorov-Smirnov test
##
## data: init_change_dat$ResDiff
## D = 0.39675, p-value < 2.2e-16
## alternative hypothesis: two-sided
qqnorm(init_change_dat$ResDiff)
coxFit <- coxph(Surv(as.numeric(paste(init_change_dat$TimeMeasure)),
init_change_dat$Event == 1) ~ init_change_dat$ResDiff)
summary(coxFit)
## Call:
## coxph(formula = Surv(as.numeric(paste(init_change_dat$TimeMeasure)),
## init_change_dat$Event == 1) ~ init_change_dat$ResDiff)
##
## n= 291, number of events= 227
##
## coef exp(coef) se(coef) z Pr(>|z|)
## init_change_dat$ResDiff -1.1406 0.3196 0.3914 -2.914 0.00356 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## init_change_dat$ResDiff 0.3196 3.129 0.1484 0.6883
##
## Concordance= 0.554 (se = 0.021 )
## Likelihood ratio test= 8.32 on 1 df, p=0.004
## Wald test = 8.49 on 1 df, p=0.004
## Score (logrank) test = 8.48 on 1 df, p=0.004
tert_p_1 <- ggplot(
init_change_dat,
aes(
x = as.factor(init_change_dat$ResDiff_3G),
y = init_change_dat$ResDiff,
colour = as.factor(init_change_dat$ResDiff_3G)
)
) +
geom_boxplot() +
xlab("RLTL change tertiles") +
ylab("RLTL change") +
theme_classic(20) +
geom_jitter() +
scale_color_manual(values = mycoloursP[16:40]) +
theme(legend.position = "none")
tert_p_1
## Warning: Use of `init_change_dat$ResDiff_3G` is discouraged. Use `ResDiff_3G`
## instead.
## Warning: Use of `init_change_dat$ResDiff` is discouraged. Use `ResDiff` instead.
## Warning: Use of `init_change_dat$ResDiff_3G` is discouraged. Use `ResDiff_3G`
## instead.
## Warning: Use of `init_change_dat$ResDiff_3G` is discouraged. Use `ResDiff_3G`
## instead.
## Warning: Use of `init_change_dat$ResDiff` is discouraged. Use `ResDiff` instead.
## Warning: Use of `init_change_dat$ResDiff_3G` is discouraged. Use `ResDiff_3G`
## instead.
init_ch_plot
pdf(file = "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/output/Fig4_A.pdf",
width = 4,
height = 4)
print(tert_p_1)
## Warning: Use of `init_change_dat$ResDiff_3G` is discouraged. Use `ResDiff_3G`
## instead.
## Warning: Use of `init_change_dat$ResDiff` is discouraged. Use `ResDiff` instead.
## Warning: Use of `init_change_dat$ResDiff_3G` is discouraged. Use `ResDiff_3G`
## instead.
## Warning: Use of `init_change_dat$ResDiff_3G` is discouraged. Use `ResDiff_3G`
## instead.
## Warning: Use of `init_change_dat$ResDiff` is discouraged. Use `ResDiff` instead.
## Warning: Use of `init_change_dat$ResDiff_3G` is discouraged. Use `ResDiff_3G`
## instead.
dev.off()
## quartz_off_screen
## 2
pdf(file = "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/output/Fig4_B.pdf",
width = 6,
height = 4)
print(init_ch_plot)
dev.off()
## quartz_off_screen
## 2
coxFit <- coxph(Surv(init_change_dat$TimeMeasure,
init_change_dat$Event == 1) ~
init_change_dat$ResDiff_3G)
summary(coxFit)
## Call:
## coxph(formula = Surv(init_change_dat$TimeMeasure, init_change_dat$Event ==
## 1) ~ init_change_dat$ResDiff_3G)
##
## n= 291, number of events= 227
##
## coef exp(coef) se(coef) z Pr(>|z|)
## init_change_dat$ResDiff_3G -0.2259 0.7978 0.0820 -2.755 0.00586 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## init_change_dat$ResDiff_3G 0.7978 1.253 0.6793 0.9369
##
## Concordance= 0.55 (se = 0.02 )
## Likelihood ratio test= 7.61 on 1 df, p=0.006
## Wald test = 7.59 on 1 df, p=0.006
## Score (logrank) test = 7.65 on 1 df, p=0.006
spaghettiData <- read.csv("/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/RC_SpaghettiData.csv")
spaghettiData$recoded_id <- as.factor(paste(spaghettiData$recoded_id))
ggplot(data = spaghettiData, aes(
x = age_y,
y = residual_rltl_t,
group = recoded_id,
colour = recoded_id
)) +
geom_point() +
geom_line() +
facet_wrap(. ~ recoded_id, ncol = 5) +
xlab("Age in years") +
ylab("RLTL residuals") +
theme_bw() +
scale_color_manual(values = mycoloursP[16:40])
#pdf(file = "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/output/Fig1_E.pdf", width = 10, height = 4)
#ggplot(data = spaghettiData, aes(x = age_y, y = residual_rltl_t, group = recoded_id, colour = recoded_id))+geom_point()+ #geom_line()+facet_wrap(.~recoded_id, ncol = 5)+
# xlab("Age in years") + ylab("RLTL residuals")+ theme_bw() + scale_color_manual(values = mycoloursP[16:40])
#dev.off()
year_p <- ggplot(
data = data,
aes(
x = sample_year,
y = residual_rltl_t,
group = recoded_id,
colour = as.factor(data$recoded_id)
)
) +
geom_point() +
geom_line() +
xlab("Sample Year") +
ylab("RLTL residuals") +
theme_classic() +
theme(legend.position = "none")
age_p <- ggplot(
data = data,
aes(
x = age_y,
y = residual_rltl_t,
group = recoded_id,
colour = as.factor(data$recoded_id)
)
) +
geom_point() +
geom_line() +
xlab("Age in years") +
ylab("RLTL residuals") +
theme_classic() +
theme(legend.position = "none")
grid.arrange(age_p, year_p, ncol = 2)
## Warning: Use of `data$recoded_id` is discouraged. Use `recoded_id` instead.
## Warning: Use of `data$recoded_id` is discouraged. Use `recoded_id` instead.
## Warning: Use of `data$recoded_id` is discouraged. Use `recoded_id` instead.
## Warning: Use of `data$recoded_id` is discouraged. Use `recoded_id` instead.
pdf(file = "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/output/Fig1_CD.pdf",
width = 10,
height = 4)
grid.arrange(age_p, year_p, ncol = 2)
## Warning: Use of `data$recoded_id` is discouraged. Use `recoded_id` instead.
## Warning: Use of `data$recoded_id` is discouraged. Use `recoded_id` instead.
## Warning: Use of `data$recoded_id` is discouraged. Use `recoded_id` instead.
## Warning: Use of `data$recoded_id` is discouraged. Use `recoded_id` instead.
graphics.off()
# average_resid rltl_change abs_rltl_change MeanChangeRate MeanChangeRateAbs
# 1)
x <- 15
AverRes <- uDeadData$average_resid
chF <- uDeadData$rltl_change
df1 <- data.frame(AverRes, chF)
cor.test(AverRes, chF)
##
## Pearson's product-moment correlation
##
## data: AverRes and chF
## t = -3.0223, df = 239, p-value = 0.002782
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.31069811 -0.06712564
## sample estimates:
## cor
## -0.1918646
CorP1 <- ggplot(df1, aes(x = AverRes, y = chF)) +
geom_point(size = 2) +
labs(x = "Mean RLTL", y = "Mean RLTL change") +
stat_smooth(method = lm, formula = y ~ x) +
theme_bw(x)
# CorP1
# 2)
AchF <- uDeadData$abs_rltl_change
df2 <- data.frame(AverRes, AchF)
cor.test(AverRes, AchF)
##
## Pearson's product-moment correlation
##
## data: AverRes and AchF
## t = 4.9383, df = 239, p-value = 1.48e-06
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.185034 0.414706
## sample estimates:
## cor
## 0.3042856
CorP2 <- ggplot(df2, aes(x = AverRes, y = AchF)) +
geom_point(size = 2) +
labs(x = "Mean RLTL", y = "Mean absolute RLTL change") +
stat_smooth(method = lm, formula = y ~ x) +
theme_bw(x)
CorP2
# 5)
df5 <- data.frame(chF, AchF)
cor.test(chF, AchF)
##
## Pearson's product-moment correlation
##
## data: chF and AchF
## t = -9.7941, df = 239, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.6196323 -0.4384552
## sample estimates:
## cor
## -0.53517
CorP5 <- ggplot(df5, aes(x = chF, y = AchF)) +
geom_point(size = 2) +
labs(x = "Mean RLTL change", y = "Mean absolute RLTL change") +
theme_bw(x) +
stat_smooth(method = lm, formula = y ~ x) +
geom_vline(xintercept = 0, linetype = "dotted") +
geom_abline(intercept = 0, slope = -1, colour = "red") +
geom_abline(intercept = 0, slope = 1, colour = "blue")
# CorP5
grid.arrange(CorP1, CorP2, CorP5, ncol = 3)
Age with reference year 0
# Age in years as factor with reference year being 0 (Age at t-1)
mod1f <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
as.factor(redData$age_y) +
redData$sample_year +
as.numeric(paste(redData$sample_interval)) +
redData$feed_group +
redData$genetic_group +
(1 | redData$recoded_id),
na.action = na.exclude)
## boundary (singular) fit: see ?isSingular
summary(mod1f)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: as.numeric(paste(redData$diff_rltl_res)) ~ as.factor(redData$age_y) +
## redData$sample_year + as.numeric(paste(redData$sample_interval)) +
## redData$feed_group + redData$genetic_group + (1 | redData$recoded_id)
##
## REML criterion at convergence: -650
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.5593 -0.6841 0.0276 0.6922 3.5944
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 2.964e-17 5.444e-09
## Residual 2.867e-02 1.693e-01
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -1.557e+01 1.224e+01 1.007e+03
## as.factor(redData$age_y)1 4.027e-02 7.165e-02 1.007e+03
## as.factor(redData$age_y)2 1.399e-01 7.190e-02 1.007e+03
## as.factor(redData$age_y)3 1.545e-01 7.271e-02 1.007e+03
## as.factor(redData$age_y)4 1.355e-01 7.411e-02 1.007e+03
## as.factor(redData$age_y)5 1.634e-01 7.677e-02 1.007e+03
## as.factor(redData$age_y)6 1.076e-01 8.193e-02 1.007e+03
## redData$sample_year 7.674e-03 6.088e-03 1.007e+03
## as.numeric(paste(redData$sample_interval)) -2.006e-05 5.256e-05 1.007e+03
## redData$feed_group2 -9.068e-03 1.192e-02 1.007e+03
## redData$feed_groupNULL -1.064e-02 1.523e-02 1.007e+03
## redData$genetic_groupS -1.437e-02 1.117e-02 1.007e+03
## t value Pr(>|t|)
## (Intercept) -1.272 0.2038
## as.factor(redData$age_y)1 0.562 0.5742
## as.factor(redData$age_y)2 1.946 0.0520 .
## as.factor(redData$age_y)3 2.125 0.0338 *
## as.factor(redData$age_y)4 1.829 0.0678 .
## as.factor(redData$age_y)5 2.128 0.0336 *
## as.factor(redData$age_y)6 1.313 0.1894
## redData$sample_year 1.261 0.2078
## as.numeric(paste(redData$sample_interval)) -0.382 0.7027
## redData$feed_group2 -0.761 0.4468
## redData$feed_groupNULL -0.698 0.4852
## redData$genetic_groupS -1.286 0.1986
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) a.(D$_)1 a.(D$_)2 a.(D$_)3 a.(D$_)4 a.(D$_)5 a.(D$_)6 rdDt$_
## as.fc(D$_)1 -0.028
## as.fc(D$_)2 0.050 0.977
## as.fc(D$_)3 0.115 0.968 0.976
## as.fc(D$_)4 0.157 0.954 0.965 0.969
## as.fc(D$_)5 0.185 0.921 0.935 0.940 0.937
## as.fc(D$_)6 0.190 0.850 0.864 0.870 0.866 0.844
## rdDt$smpl_y -1.000 0.022 -0.056 -0.121 -0.162 -0.190 -0.194
## as.n((D$_)) 0.096 -0.218 -0.217 -0.220 -0.236 -0.225 -0.146 -0.096
## rdDt$fd_gr2 -0.042 -0.035 -0.041 -0.043 -0.051 -0.064 -0.079 0.042
## rdDt$f_NULL 0.086 0.024 0.041 0.052 0.051 0.051 0.064 -0.087
## rdDt$gntc_S 0.072 0.028 0.033 0.042 0.042 0.049 0.059 -0.072
## a.((D$ rdD$_2 rD$_NU
## as.fc(D$_)1
## as.fc(D$_)2
## as.fc(D$_)3
## as.fc(D$_)4
## as.fc(D$_)5
## as.fc(D$_)6
## rdDt$smpl_y
## as.n((D$_))
## rdDt$fd_gr2 0.045
## rdDt$f_NULL -0.044 0.370
## rdDt$gntc_S 0.060 -0.030 0.242
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(mod1f)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## as.factor(redData$age_y) 1.58118 0.263529 6 1007 9.1926
## redData$sample_year 0.04555 0.045550 1 1007 1.5889
## as.numeric(paste(redData$sample_interval)) 0.00418 0.004177 1 1007 0.1457
## redData$feed_group 0.02237 0.011183 2 1007 0.3901
## redData$genetic_group 0.04744 0.047438 1 1007 1.6547
## Pr(>F)
## as.factor(redData$age_y) 8.079e-10 ***
## redData$sample_year 0.2078
## as.numeric(paste(redData$sample_interval)) 0.7027
## redData$feed_group 0.6771
## redData$genetic_group 0.1986
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Log likelihod ratio test to see if animal is significant as random effect
redData$R_age_y <- as.factor(redData$age_y)
# lm without random effect to do likelihood ratio test
modLM <- glm(as.numeric(paste(redData$diff_rltl_res)) ~
as.factor(redData$age_y) +
redData$sample_year +
as.numeric(paste(redData$sample_interval)) +
redData$feed_group +
redData$genetic_group)
anova(mod1f, modLM)
## refitting model(s) with ML (instead of REML)
## Data: NULL
## Models:
## modLM: as.numeric(paste(redData$diff_rltl_res)) ~ as.factor(redData$age_y) +
## modLM: redData$sample_year + as.numeric(paste(redData$sample_interval)) +
## modLM: redData$feed_group + redData$genetic_group
## mod1f: as.numeric(paste(redData$diff_rltl_res)) ~ as.factor(redData$age_y) +
## mod1f: redData$sample_year + as.numeric(paste(redData$sample_interval)) +
## mod1f: redData$feed_group + redData$genetic_group + (1 | redData$recoded_id)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## modLM 13 -713.75 -649.71 369.88 -739.75
## mod1f 14 -711.75 -642.78 369.88 -739.75 0 1 1
logLik(mod1f)
## 'log Lik.' 324.9983 (df=14)
logLik(modLM)
## 'log Lik.' 369.876 (df=13)
Animal ID is not significant as random effect.
# Age in years as factor with reference year being 1 (Age at t-1)
redData$age_y <- as.factor(redData$age_y)
contrasts(redData$age_y) <- contr.treatment(levels(redData$age_y),
base = which(levels(redData$age_y) == "1"))
mod1f <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
as.factor(redData$age_y) +
redData$sample_year +
as.numeric(paste(redData$sample_interval)) +
redData$feed_group +
redData$genetic_group +
(1 | redData$recoded_id),
na.action = na.exclude)
## boundary (singular) fit: see ?isSingular
summary(mod1f)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: as.numeric(paste(redData$diff_rltl_res)) ~ as.factor(redData$age_y) +
## redData$sample_year + as.numeric(paste(redData$sample_interval)) +
## redData$feed_group + redData$genetic_group + (1 | redData$recoded_id)
##
## REML criterion at convergence: -650
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.5593 -0.6841 0.0276 0.6922 3.5944
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 6.229e-18 2.496e-09
## Residual 2.867e-02 1.693e-01
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -1.553e+01 1.224e+01 1.007e+03
## as.factor(redData$age_y)0 -4.027e-02 7.165e-02 1.007e+03
## as.factor(redData$age_y)2 9.962e-02 1.530e-02 1.007e+03
## as.factor(redData$age_y)3 1.143e-01 1.837e-02 1.007e+03
## as.factor(redData$age_y)4 9.524e-02 2.225e-02 1.007e+03
## as.factor(redData$age_y)5 1.231e-01 2.997e-02 1.007e+03
## as.factor(redData$age_y)6 6.731e-02 4.322e-02 1.007e+03
## redData$sample_year 7.674e-03 6.088e-03 1.007e+03
## as.numeric(paste(redData$sample_interval)) -2.006e-05 5.256e-05 1.007e+03
## redData$feed_group2 -9.068e-03 1.192e-02 1.007e+03
## redData$feed_groupNULL -1.064e-02 1.523e-02 1.007e+03
## redData$genetic_groupS -1.437e-02 1.117e-02 1.007e+03
## t value Pr(>|t|)
## (Intercept) -1.269 0.205
## as.factor(redData$age_y)0 -0.562 0.574
## as.factor(redData$age_y)2 6.509 1.19e-10 ***
## as.factor(redData$age_y)3 6.221 7.25e-10 ***
## as.factor(redData$age_y)4 4.280 2.05e-05 ***
## as.factor(redData$age_y)5 4.107 4.33e-05 ***
## as.factor(redData$age_y)6 1.558 0.120
## redData$sample_year 1.261 0.208
## as.numeric(paste(redData$sample_interval)) -0.382 0.703
## redData$feed_group2 -0.761 0.447
## redData$feed_groupNULL -0.698 0.485
## redData$genetic_groupS -1.286 0.199
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) a.(D$_)0 a.(D$_)2 a.(D$_)3 a.(D$_)4 a.(D$_)5 a.(D$_)6 rdDt$_
## as.fc(D$_)0 0.022
## as.fc(D$_)2 0.364 0.091
## as.fc(D$_)3 0.563 0.070 0.567
## as.fc(D$_)4 0.610 0.043 0.524 0.603
## as.fc(D$_)5 0.540 0.032 0.422 0.498 0.499
## as.fc(D$_)6 0.405 0.047 0.303 0.357 0.350 0.299
## rdDt$smpl_y -1.000 -0.022 -0.365 -0.564 -0.611 -0.541 -0.405
## as.n((D$_)) 0.095 0.218 0.001 -0.020 -0.085 -0.055 0.085 -0.096
## rdDt$fd_gr2 -0.042 0.035 -0.031 -0.036 -0.057 -0.081 -0.091 0.042
## rdDt$f_NULL 0.086 -0.024 0.079 0.111 0.093 0.073 0.081 -0.087
## rdDt$gntc_S 0.072 -0.028 0.022 0.057 0.050 0.058 0.064 -0.072
## a.((D$ rdD$_2 rD$_NU
## as.fc(D$_)0
## as.fc(D$_)2
## as.fc(D$_)3
## as.fc(D$_)4
## as.fc(D$_)5
## as.fc(D$_)6
## rdDt$smpl_y
## as.n((D$_))
## rdDt$fd_gr2 0.045
## rdDt$f_NULL -0.044 0.370
## rdDt$gntc_S 0.060 -0.030 0.242
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(mod1f)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## as.factor(redData$age_y) 1.58118 0.263529 6 1007 9.1926
## redData$sample_year 0.04555 0.045550 1 1007 1.5889
## as.numeric(paste(redData$sample_interval)) 0.00418 0.004177 1 1007 0.1457
## redData$feed_group 0.02237 0.011183 2 1007 0.3901
## redData$genetic_group 0.04744 0.047438 1 1007 1.6547
## Pr(>F)
## as.factor(redData$age_y) 8.079e-10 ***
## redData$sample_year 0.2078
## as.numeric(paste(redData$sample_interval)) 0.7027
## redData$feed_group 0.6771
## redData$genetic_group 0.1986
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# Age in years as factor with reference year being 1 (Age at t-1)
redData$age_y <- as.factor(redData$age_y)
contrasts(redData$age_y) <- contr.treatment(levels(redData$age_y),
base = which(levels(redData$age_y) == "1"))
mod2f <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
as.factor(redData$age_y) +
#redData$sample_year +
#as.numeric(paste(redData$sample_interval)) +
(1 | redData$recoded_id),
na.action = na.exclude)
## boundary (singular) fit: see ?isSingular
summary(mod2f)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: as.numeric(paste(redData$diff_rltl_res)) ~ as.factor(redData$age_y) +
## (1 | redData$recoded_id)
##
## REML criterion at convergence: -693.4
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.6177 -0.6765 0.0386 0.6806 3.5183
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 0.00000 0.0000
## Residual 0.02863 0.1692
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) -1.151e-01 9.988e-03 1.012e+03 -11.528 < 2e-16 ***
## as.factor(redData$age_y)0 -3.630e-02 6.980e-02 1.012e+03 -0.520 0.6032
## as.factor(redData$age_y)2 1.063e-01 1.420e-02 1.012e+03 7.485 1.56e-13 ***
## as.factor(redData$age_y)3 1.273e-01 1.505e-02 1.012e+03 8.456 < 2e-16 ***
## as.factor(redData$age_y)4 1.114e-01 1.728e-02 1.012e+03 6.449 1.74e-10 ***
## as.factor(redData$age_y)5 1.422e-01 2.491e-02 1.012e+03 5.711 1.48e-08 ***
## as.factor(redData$age_y)6 8.883e-02 3.913e-02 1.012e+03 2.270 0.0234 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) a.(D$_)0 a.(D$_)2 a.(D$_)3 a.(D$_)4 a.(D$_)5
## as.fc(D$_)0 -0.143
## as.fc(D$_)2 -0.703 0.101
## as.fc(D$_)3 -0.664 0.095 0.467
## as.fc(D$_)4 -0.578 0.083 0.407 0.384
## as.fc(D$_)5 -0.401 0.057 0.282 0.266 0.232
## as.fc(D$_)6 -0.255 0.037 0.180 0.169 0.148 0.102
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(mod2f)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
## as.factor(redData$age_y) 2.9674 0.49456 6 1012 17.273 < 2.2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
exclude2009 <- subset(redData, redData$sample_year != "2009")
mod1f <- lmer(as.numeric(paste(exclude2009$diff_rltl_res)) ~
as.factor(exclude2009$age_y) +
exclude2009$sample_year +
as.numeric(paste(exclude2009$sample_interval)) +
exclude2009$feed_group +
exclude2009$genetic_group +
(1 | exclude2009$recoded_id), na.action = na.exclude)
## boundary (singular) fit: see ?isSingular
summary(mod1f)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(exclude2009$diff_rltl_res)) ~ as.factor(exclude2009$age_y) +
## exclude2009$sample_year + as.numeric(paste(exclude2009$sample_interval)) +
## exclude2009$feed_group + exclude2009$genetic_group + (1 |
## exclude2009$recoded_id)
##
## REML criterion at convergence: -650
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.5593 -0.6841 0.0276 0.6922 3.5944
##
## Random effects:
## Groups Name Variance Std.Dev.
## exclude2009$recoded_id (Intercept) 6.229e-18 2.496e-09
## Residual 2.867e-02 1.693e-01
## Number of obs: 1019, groups: exclude2009$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -1.553e+01 1.224e+01 1.007e+03
## as.factor(exclude2009$age_y)0 -4.027e-02 7.165e-02 1.007e+03
## as.factor(exclude2009$age_y)2 9.962e-02 1.530e-02 1.007e+03
## as.factor(exclude2009$age_y)3 1.143e-01 1.837e-02 1.007e+03
## as.factor(exclude2009$age_y)4 9.524e-02 2.225e-02 1.007e+03
## as.factor(exclude2009$age_y)5 1.231e-01 2.997e-02 1.007e+03
## as.factor(exclude2009$age_y)6 6.731e-02 4.322e-02 1.007e+03
## exclude2009$sample_year 7.674e-03 6.088e-03 1.007e+03
## as.numeric(paste(exclude2009$sample_interval)) -2.006e-05 5.256e-05 1.007e+03
## exclude2009$feed_group2 -9.068e-03 1.192e-02 1.007e+03
## exclude2009$feed_groupNULL -1.064e-02 1.523e-02 1.007e+03
## exclude2009$genetic_groupS -1.437e-02 1.117e-02 1.007e+03
## t value Pr(>|t|)
## (Intercept) -1.269 0.205
## as.factor(exclude2009$age_y)0 -0.562 0.574
## as.factor(exclude2009$age_y)2 6.509 1.19e-10 ***
## as.factor(exclude2009$age_y)3 6.221 7.25e-10 ***
## as.factor(exclude2009$age_y)4 4.280 2.05e-05 ***
## as.factor(exclude2009$age_y)5 4.107 4.33e-05 ***
## as.factor(exclude2009$age_y)6 1.558 0.120
## exclude2009$sample_year 1.261 0.208
## as.numeric(paste(exclude2009$sample_interval)) -0.382 0.703
## exclude2009$feed_group2 -0.761 0.447
## exclude2009$feed_groupNULL -0.698 0.485
## exclude2009$genetic_groupS -1.286 0.199
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) a.(2009$_)0 a.(2009$_)2 a.(2009$_)3 a.(2009$_)4 a.(2009$_)5
## a.(2009$_)0 0.022
## a.(2009$_)2 0.364 0.091
## a.(2009$_)3 0.563 0.070 0.567
## a.(2009$_)4 0.610 0.043 0.524 0.603
## a.(2009$_)5 0.540 0.032 0.422 0.498 0.499
## a.(2009$_)6 0.405 0.047 0.303 0.357 0.350 0.299
## excld2009$_ -1.000 -0.022 -0.365 -0.564 -0.611 -0.541
## a.((2009$_) 0.095 0.218 0.001 -0.020 -0.085 -0.055
## excl2009$_2 -0.042 0.035 -0.031 -0.036 -0.057 -0.081
## e2009$_NULL 0.086 -0.024 0.079 0.111 0.093 0.073
## excl2009$_S 0.072 -0.028 0.022 0.057 0.050 0.058
## a.(2009$_)6 ex2009$_ a.((20 e2009$_2 e2009$_N
## a.(2009$_)0
## a.(2009$_)2
## a.(2009$_)3
## a.(2009$_)4
## a.(2009$_)5
## a.(2009$_)6
## excld2009$_ -0.405
## a.((2009$_) 0.085 -0.096
## excl2009$_2 -0.091 0.042 0.045
## e2009$_NULL 0.081 -0.087 -0.044 0.370
## excl2009$_S 0.064 -0.072 0.060 -0.030 0.242
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(mod1f)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF
## as.factor(exclude2009$age_y) 1.58118 0.263529 6 1007
## exclude2009$sample_year 0.04555 0.045550 1 1007
## as.numeric(paste(exclude2009$sample_interval)) 0.00418 0.004177 1 1007
## exclude2009$feed_group 0.02237 0.011183 2 1007
## exclude2009$genetic_group 0.04744 0.047438 1 1007
## F value Pr(>F)
## as.factor(exclude2009$age_y) 9.1926 8.079e-10 ***
## exclude2009$sample_year 1.5889 0.2078
## as.numeric(paste(exclude2009$sample_interval)) 0.1457 0.7027
## exclude2009$feed_group 0.3901 0.6771
## exclude2009$genetic_group 1.6547 0.1986
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
df<-as.data.frame(round(coef(summary(mod1f)),3))
df
## Estimate Std. Error df t value
## (Intercept) -15.529 12.242 1007 -1.269
## as.factor(exclude2009$age_y)0 -0.040 0.072 1007 -0.562
## as.factor(exclude2009$age_y)2 0.100 0.015 1007 6.509
## as.factor(exclude2009$age_y)3 0.114 0.018 1007 6.221
## as.factor(exclude2009$age_y)4 0.095 0.022 1007 4.280
## as.factor(exclude2009$age_y)5 0.123 0.030 1007 4.107
## as.factor(exclude2009$age_y)6 0.067 0.043 1007 1.558
## exclude2009$sample_year 0.008 0.006 1007 1.261
## as.numeric(paste(exclude2009$sample_interval)) 0.000 0.000 1007 -0.382
## exclude2009$feed_group2 -0.009 0.012 1007 -0.761
## exclude2009$feed_groupNULL -0.011 0.015 1007 -0.698
## exclude2009$genetic_groupS -0.014 0.011 1007 -1.286
## Pr(>|t|)
## (Intercept) 0.205
## as.factor(exclude2009$age_y)0 0.574
## as.factor(exclude2009$age_y)2 0.000
## as.factor(exclude2009$age_y)3 0.000
## as.factor(exclude2009$age_y)4 0.000
## as.factor(exclude2009$age_y)5 0.000
## as.factor(exclude2009$age_y)6 0.120
## exclude2009$sample_year 0.208
## as.numeric(paste(exclude2009$sample_interval)) 0.703
## exclude2009$feed_group2 0.447
## exclude2009$feed_groupNULL 0.485
## exclude2009$genetic_groupS 0.199
#write.csv(df, "/Users/luiseseeker/Desktop/PNAS/S2_Table_AgeFactor.csv")
#lsmeans(mod1f,pairwise~as.factor(redData$R_age_y), adjust="Bonferroni")
#Age in years as factor with reference year being 2 (Age at t-1)
contrasts(redData$R_age_y) <- contr.treatment(levels(redData$R_age_y),
base=which(levels(redData$R_age_y) == '2'))
mod1f<-lmer(as.numeric(paste(redData$diff_rltl_res)) ~
as.factor(redData$age_y) +
redData$sample_year +
as.numeric(paste(redData$sample_interval)) +
redData$feed_group +
redData$genetic_group +
(1|redData$recoded_id), na.action=na.exclude)
## boundary (singular) fit: see ?isSingular
summary(mod1f)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: as.numeric(paste(redData$diff_rltl_res)) ~ as.factor(redData$age_y) +
## redData$sample_year + as.numeric(paste(redData$sample_interval)) +
## redData$feed_group + redData$genetic_group + (1 | redData$recoded_id)
##
## REML criterion at convergence: -650
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.5593 -0.6841 0.0276 0.6922 3.5944
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 6.229e-18 2.496e-09
## Residual 2.867e-02 1.693e-01
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -1.553e+01 1.224e+01 1.007e+03
## as.factor(redData$age_y)0 -4.027e-02 7.165e-02 1.007e+03
## as.factor(redData$age_y)2 9.962e-02 1.530e-02 1.007e+03
## as.factor(redData$age_y)3 1.143e-01 1.837e-02 1.007e+03
## as.factor(redData$age_y)4 9.524e-02 2.225e-02 1.007e+03
## as.factor(redData$age_y)5 1.231e-01 2.997e-02 1.007e+03
## as.factor(redData$age_y)6 6.731e-02 4.322e-02 1.007e+03
## redData$sample_year 7.674e-03 6.088e-03 1.007e+03
## as.numeric(paste(redData$sample_interval)) -2.006e-05 5.256e-05 1.007e+03
## redData$feed_group2 -9.068e-03 1.192e-02 1.007e+03
## redData$feed_groupNULL -1.064e-02 1.523e-02 1.007e+03
## redData$genetic_groupS -1.437e-02 1.117e-02 1.007e+03
## t value Pr(>|t|)
## (Intercept) -1.269 0.205
## as.factor(redData$age_y)0 -0.562 0.574
## as.factor(redData$age_y)2 6.509 1.19e-10 ***
## as.factor(redData$age_y)3 6.221 7.25e-10 ***
## as.factor(redData$age_y)4 4.280 2.05e-05 ***
## as.factor(redData$age_y)5 4.107 4.33e-05 ***
## as.factor(redData$age_y)6 1.558 0.120
## redData$sample_year 1.261 0.208
## as.numeric(paste(redData$sample_interval)) -0.382 0.703
## redData$feed_group2 -0.761 0.447
## redData$feed_groupNULL -0.698 0.485
## redData$genetic_groupS -1.286 0.199
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) a.(D$_)0 a.(D$_)2 a.(D$_)3 a.(D$_)4 a.(D$_)5 a.(D$_)6 rdDt$_
## as.fc(D$_)0 0.022
## as.fc(D$_)2 0.364 0.091
## as.fc(D$_)3 0.563 0.070 0.567
## as.fc(D$_)4 0.610 0.043 0.524 0.603
## as.fc(D$_)5 0.540 0.032 0.422 0.498 0.499
## as.fc(D$_)6 0.405 0.047 0.303 0.357 0.350 0.299
## rdDt$smpl_y -1.000 -0.022 -0.365 -0.564 -0.611 -0.541 -0.405
## as.n((D$_)) 0.095 0.218 0.001 -0.020 -0.085 -0.055 0.085 -0.096
## rdDt$fd_gr2 -0.042 0.035 -0.031 -0.036 -0.057 -0.081 -0.091 0.042
## rdDt$f_NULL 0.086 -0.024 0.079 0.111 0.093 0.073 0.081 -0.087
## rdDt$gntc_S 0.072 -0.028 0.022 0.057 0.050 0.058 0.064 -0.072
## a.((D$ rdD$_2 rD$_NU
## as.fc(D$_)0
## as.fc(D$_)2
## as.fc(D$_)3
## as.fc(D$_)4
## as.fc(D$_)5
## as.fc(D$_)6
## rdDt$smpl_y
## as.n((D$_))
## rdDt$fd_gr2 0.045
## rdDt$f_NULL -0.044 0.370
## rdDt$gntc_S 0.060 -0.030 0.242
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(mod1f)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## as.factor(redData$age_y) 1.58118 0.263529 6 1007 9.1926
## redData$sample_year 0.04555 0.045550 1 1007 1.5889
## as.numeric(paste(redData$sample_interval)) 0.00418 0.004177 1 1007 0.1457
## redData$feed_group 0.02237 0.011183 2 1007 0.3901
## redData$genetic_group 0.04744 0.047438 1 1007 1.6547
## Pr(>F)
## as.factor(redData$age_y) 8.079e-10 ***
## redData$sample_year 0.2078
## as.numeric(paste(redData$sample_interval)) 0.7027
## redData$feed_group 0.6771
## redData$genetic_group 0.1986
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Age in years as factor with reference year being 3 (Age at t-1)
contrasts(redData$R_age_y) <- contr.treatment(levels(redData$R_age_y),
base=which(levels(redData$R_age_y) == '3'))
mod1f <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
as.factor(redData$age_y) +
redData$sample_year +
as.numeric(paste(redData$sample_interval)) +
redData$feed_group +
redData$genetic_group +
(1|redData$recoded_id),
na.action=na.exclude)
## boundary (singular) fit: see ?isSingular
summary(mod1f)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: as.numeric(paste(redData$diff_rltl_res)) ~ as.factor(redData$age_y) +
## redData$sample_year + as.numeric(paste(redData$sample_interval)) +
## redData$feed_group + redData$genetic_group + (1 | redData$recoded_id)
##
## REML criterion at convergence: -650
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.5593 -0.6841 0.0276 0.6922 3.5944
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 6.229e-18 2.496e-09
## Residual 2.867e-02 1.693e-01
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -1.553e+01 1.224e+01 1.007e+03
## as.factor(redData$age_y)0 -4.027e-02 7.165e-02 1.007e+03
## as.factor(redData$age_y)2 9.962e-02 1.530e-02 1.007e+03
## as.factor(redData$age_y)3 1.143e-01 1.837e-02 1.007e+03
## as.factor(redData$age_y)4 9.524e-02 2.225e-02 1.007e+03
## as.factor(redData$age_y)5 1.231e-01 2.997e-02 1.007e+03
## as.factor(redData$age_y)6 6.731e-02 4.322e-02 1.007e+03
## redData$sample_year 7.674e-03 6.088e-03 1.007e+03
## as.numeric(paste(redData$sample_interval)) -2.006e-05 5.256e-05 1.007e+03
## redData$feed_group2 -9.068e-03 1.192e-02 1.007e+03
## redData$feed_groupNULL -1.064e-02 1.523e-02 1.007e+03
## redData$genetic_groupS -1.437e-02 1.117e-02 1.007e+03
## t value Pr(>|t|)
## (Intercept) -1.269 0.205
## as.factor(redData$age_y)0 -0.562 0.574
## as.factor(redData$age_y)2 6.509 1.19e-10 ***
## as.factor(redData$age_y)3 6.221 7.25e-10 ***
## as.factor(redData$age_y)4 4.280 2.05e-05 ***
## as.factor(redData$age_y)5 4.107 4.33e-05 ***
## as.factor(redData$age_y)6 1.558 0.120
## redData$sample_year 1.261 0.208
## as.numeric(paste(redData$sample_interval)) -0.382 0.703
## redData$feed_group2 -0.761 0.447
## redData$feed_groupNULL -0.698 0.485
## redData$genetic_groupS -1.286 0.199
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) a.(D$_)0 a.(D$_)2 a.(D$_)3 a.(D$_)4 a.(D$_)5 a.(D$_)6 rdDt$_
## as.fc(D$_)0 0.022
## as.fc(D$_)2 0.364 0.091
## as.fc(D$_)3 0.563 0.070 0.567
## as.fc(D$_)4 0.610 0.043 0.524 0.603
## as.fc(D$_)5 0.540 0.032 0.422 0.498 0.499
## as.fc(D$_)6 0.405 0.047 0.303 0.357 0.350 0.299
## rdDt$smpl_y -1.000 -0.022 -0.365 -0.564 -0.611 -0.541 -0.405
## as.n((D$_)) 0.095 0.218 0.001 -0.020 -0.085 -0.055 0.085 -0.096
## rdDt$fd_gr2 -0.042 0.035 -0.031 -0.036 -0.057 -0.081 -0.091 0.042
## rdDt$f_NULL 0.086 -0.024 0.079 0.111 0.093 0.073 0.081 -0.087
## rdDt$gntc_S 0.072 -0.028 0.022 0.057 0.050 0.058 0.064 -0.072
## a.((D$ rdD$_2 rD$_NU
## as.fc(D$_)0
## as.fc(D$_)2
## as.fc(D$_)3
## as.fc(D$_)4
## as.fc(D$_)5
## as.fc(D$_)6
## rdDt$smpl_y
## as.n((D$_))
## rdDt$fd_gr2 0.045
## rdDt$f_NULL -0.044 0.370
## rdDt$gntc_S 0.060 -0.030 0.242
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(mod1f)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## as.factor(redData$age_y) 1.58118 0.263529 6 1007 9.1926
## redData$sample_year 0.04555 0.045550 1 1007 1.5889
## as.numeric(paste(redData$sample_interval)) 0.00418 0.004177 1 1007 0.1457
## redData$feed_group 0.02237 0.011183 2 1007 0.3901
## redData$genetic_group 0.04744 0.047438 1 1007 1.6547
## Pr(>F)
## as.factor(redData$age_y) 8.079e-10 ***
## redData$sample_year 0.2078
## as.numeric(paste(redData$sample_interval)) 0.7027
## redData$feed_group 0.6771
## redData$genetic_group 0.1986
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Age in years as factor with reference year being 4 (Age at t-1)
contrasts(redData$R_age_y) <- contr.treatment(levels(redData$R_age_y),
base=which(levels(redData$R_age_y) == '4'))
mod1f <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
as.factor(redData$age_y) +
redData$sample_year +
as.numeric(paste(redData$sample_interval)) +
redData$feed_group +
redData$genetic_group +
(1|redData$recoded_id), na.action=na.exclude)
## boundary (singular) fit: see ?isSingular
summary(mod1f)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: as.numeric(paste(redData$diff_rltl_res)) ~ as.factor(redData$age_y) +
## redData$sample_year + as.numeric(paste(redData$sample_interval)) +
## redData$feed_group + redData$genetic_group + (1 | redData$recoded_id)
##
## REML criterion at convergence: -650
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.5593 -0.6841 0.0276 0.6922 3.5944
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 6.229e-18 2.496e-09
## Residual 2.867e-02 1.693e-01
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -1.553e+01 1.224e+01 1.007e+03
## as.factor(redData$age_y)0 -4.027e-02 7.165e-02 1.007e+03
## as.factor(redData$age_y)2 9.962e-02 1.530e-02 1.007e+03
## as.factor(redData$age_y)3 1.143e-01 1.837e-02 1.007e+03
## as.factor(redData$age_y)4 9.524e-02 2.225e-02 1.007e+03
## as.factor(redData$age_y)5 1.231e-01 2.997e-02 1.007e+03
## as.factor(redData$age_y)6 6.731e-02 4.322e-02 1.007e+03
## redData$sample_year 7.674e-03 6.088e-03 1.007e+03
## as.numeric(paste(redData$sample_interval)) -2.006e-05 5.256e-05 1.007e+03
## redData$feed_group2 -9.068e-03 1.192e-02 1.007e+03
## redData$feed_groupNULL -1.064e-02 1.523e-02 1.007e+03
## redData$genetic_groupS -1.437e-02 1.117e-02 1.007e+03
## t value Pr(>|t|)
## (Intercept) -1.269 0.205
## as.factor(redData$age_y)0 -0.562 0.574
## as.factor(redData$age_y)2 6.509 1.19e-10 ***
## as.factor(redData$age_y)3 6.221 7.25e-10 ***
## as.factor(redData$age_y)4 4.280 2.05e-05 ***
## as.factor(redData$age_y)5 4.107 4.33e-05 ***
## as.factor(redData$age_y)6 1.558 0.120
## redData$sample_year 1.261 0.208
## as.numeric(paste(redData$sample_interval)) -0.382 0.703
## redData$feed_group2 -0.761 0.447
## redData$feed_groupNULL -0.698 0.485
## redData$genetic_groupS -1.286 0.199
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) a.(D$_)0 a.(D$_)2 a.(D$_)3 a.(D$_)4 a.(D$_)5 a.(D$_)6 rdDt$_
## as.fc(D$_)0 0.022
## as.fc(D$_)2 0.364 0.091
## as.fc(D$_)3 0.563 0.070 0.567
## as.fc(D$_)4 0.610 0.043 0.524 0.603
## as.fc(D$_)5 0.540 0.032 0.422 0.498 0.499
## as.fc(D$_)6 0.405 0.047 0.303 0.357 0.350 0.299
## rdDt$smpl_y -1.000 -0.022 -0.365 -0.564 -0.611 -0.541 -0.405
## as.n((D$_)) 0.095 0.218 0.001 -0.020 -0.085 -0.055 0.085 -0.096
## rdDt$fd_gr2 -0.042 0.035 -0.031 -0.036 -0.057 -0.081 -0.091 0.042
## rdDt$f_NULL 0.086 -0.024 0.079 0.111 0.093 0.073 0.081 -0.087
## rdDt$gntc_S 0.072 -0.028 0.022 0.057 0.050 0.058 0.064 -0.072
## a.((D$ rdD$_2 rD$_NU
## as.fc(D$_)0
## as.fc(D$_)2
## as.fc(D$_)3
## as.fc(D$_)4
## as.fc(D$_)5
## as.fc(D$_)6
## rdDt$smpl_y
## as.n((D$_))
## rdDt$fd_gr2 0.045
## rdDt$f_NULL -0.044 0.370
## rdDt$gntc_S 0.060 -0.030 0.242
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(mod1f)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## as.factor(redData$age_y) 1.58118 0.263529 6 1007 9.1926
## redData$sample_year 0.04555 0.045550 1 1007 1.5889
## as.numeric(paste(redData$sample_interval)) 0.00418 0.004177 1 1007 0.1457
## redData$feed_group 0.02237 0.011183 2 1007 0.3901
## redData$genetic_group 0.04744 0.047438 1 1007 1.6547
## Pr(>F)
## as.factor(redData$age_y) 8.079e-10 ***
## redData$sample_year 0.2078
## as.numeric(paste(redData$sample_interval)) 0.7027
## redData$feed_group 0.6771
## redData$genetic_group 0.1986
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Age in years as factor with reference year being 5 (Age at t-1)
contrasts(redData$R_age_y) <- contr.treatment(levels(redData$R_age_y),
base=which(levels(redData$R_age_y) == '5'))
mod1f <- lmer(as.numeric(paste(redData$diff_rltl_res)) ~
as.factor(redData$age_y) +
redData$sample_year +
as.numeric(paste(redData$sample_interval)) +
redData$feed_group +
redData$genetic_group +
(1|redData$recoded_id), na.action=na.exclude)
## boundary (singular) fit: see ?isSingular
summary(mod1f)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: as.numeric(paste(redData$diff_rltl_res)) ~ as.factor(redData$age_y) +
## redData$sample_year + as.numeric(paste(redData$sample_interval)) +
## redData$feed_group + redData$genetic_group + (1 | redData$recoded_id)
##
## REML criterion at convergence: -650
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.5593 -0.6841 0.0276 0.6922 3.5944
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 6.229e-18 2.496e-09
## Residual 2.867e-02 1.693e-01
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -1.553e+01 1.224e+01 1.007e+03
## as.factor(redData$age_y)0 -4.027e-02 7.165e-02 1.007e+03
## as.factor(redData$age_y)2 9.962e-02 1.530e-02 1.007e+03
## as.factor(redData$age_y)3 1.143e-01 1.837e-02 1.007e+03
## as.factor(redData$age_y)4 9.524e-02 2.225e-02 1.007e+03
## as.factor(redData$age_y)5 1.231e-01 2.997e-02 1.007e+03
## as.factor(redData$age_y)6 6.731e-02 4.322e-02 1.007e+03
## redData$sample_year 7.674e-03 6.088e-03 1.007e+03
## as.numeric(paste(redData$sample_interval)) -2.006e-05 5.256e-05 1.007e+03
## redData$feed_group2 -9.068e-03 1.192e-02 1.007e+03
## redData$feed_groupNULL -1.064e-02 1.523e-02 1.007e+03
## redData$genetic_groupS -1.437e-02 1.117e-02 1.007e+03
## t value Pr(>|t|)
## (Intercept) -1.269 0.205
## as.factor(redData$age_y)0 -0.562 0.574
## as.factor(redData$age_y)2 6.509 1.19e-10 ***
## as.factor(redData$age_y)3 6.221 7.25e-10 ***
## as.factor(redData$age_y)4 4.280 2.05e-05 ***
## as.factor(redData$age_y)5 4.107 4.33e-05 ***
## as.factor(redData$age_y)6 1.558 0.120
## redData$sample_year 1.261 0.208
## as.numeric(paste(redData$sample_interval)) -0.382 0.703
## redData$feed_group2 -0.761 0.447
## redData$feed_groupNULL -0.698 0.485
## redData$genetic_groupS -1.286 0.199
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) a.(D$_)0 a.(D$_)2 a.(D$_)3 a.(D$_)4 a.(D$_)5 a.(D$_)6 rdDt$_
## as.fc(D$_)0 0.022
## as.fc(D$_)2 0.364 0.091
## as.fc(D$_)3 0.563 0.070 0.567
## as.fc(D$_)4 0.610 0.043 0.524 0.603
## as.fc(D$_)5 0.540 0.032 0.422 0.498 0.499
## as.fc(D$_)6 0.405 0.047 0.303 0.357 0.350 0.299
## rdDt$smpl_y -1.000 -0.022 -0.365 -0.564 -0.611 -0.541 -0.405
## as.n((D$_)) 0.095 0.218 0.001 -0.020 -0.085 -0.055 0.085 -0.096
## rdDt$fd_gr2 -0.042 0.035 -0.031 -0.036 -0.057 -0.081 -0.091 0.042
## rdDt$f_NULL 0.086 -0.024 0.079 0.111 0.093 0.073 0.081 -0.087
## rdDt$gntc_S 0.072 -0.028 0.022 0.057 0.050 0.058 0.064 -0.072
## a.((D$ rdD$_2 rD$_NU
## as.fc(D$_)0
## as.fc(D$_)2
## as.fc(D$_)3
## as.fc(D$_)4
## as.fc(D$_)5
## as.fc(D$_)6
## rdDt$smpl_y
## as.n((D$_))
## rdDt$fd_gr2 0.045
## rdDt$f_NULL -0.044 0.370
## rdDt$gntc_S 0.060 -0.030 0.242
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
anova(mod1f)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF F value
## as.factor(redData$age_y) 1.58118 0.263529 6 1007 9.1926
## redData$sample_year 0.04555 0.045550 1 1007 1.5889
## as.numeric(paste(redData$sample_interval)) 0.00418 0.004177 1 1007 0.1457
## redData$feed_group 0.02237 0.011183 2 1007 0.3901
## redData$genetic_group 0.04744 0.047438 1 1007 1.6547
## Pr(>F)
## as.factor(redData$age_y) 8.079e-10 ***
## redData$sample_year 0.2078
## as.numeric(paste(redData$sample_interval)) 0.7027
## redData$feed_group 0.6771
## redData$genetic_group 0.1986
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
nrow(subset(redData, redData$age_y == 6))
## [1] 20
In a lot pf publications RLTL change is investigated by fitting a model of RLTL at time t and with RLTL at time t-1 as covariate. This is different to looking at RLTL change and fitting RLTL at the first time point as covariate which is problematic due to statistical problems that happen due to regression to the mean.
mod1 <- lmer(as.numeric(paste(redData$residual_rltl_t)) ~
as.numeric(paste(redData$residual_rltl_tminus1)) +
as.factor(redData$age_y) +
redData$sample_year +
as.numeric(paste(redData$sample_interval)) +
redData$feed_group +
redData$genetic_group +
(1|redData$recoded_id), na.action=na.exclude)
summary(mod1)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(redData$residual_rltl_t)) ~ as.numeric(paste(redData$residual_rltl_tminus1)) +
## as.factor(redData$age_y) + redData$sample_year + as.numeric(paste(redData$sample_interval)) +
## redData$feed_group + redData$genetic_group + (1 | redData$recoded_id)
##
## REML criterion at convergence: -1051.7
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.5536 -0.6651 -0.0687 0.5785 3.1145
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 0.005017 0.07083
## Residual 0.015504 0.12452
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error
## (Intercept) 7.046e+00 1.204e+01
## as.numeric(paste(redData$residual_rltl_tminus1)) 1.817e-01 3.009e-02
## as.factor(redData$age_y)0 6.777e-02 5.883e-02
## as.factor(redData$age_y)2 2.279e-02 1.240e-02
## as.factor(redData$age_y)3 3.418e-02 1.598e-02
## as.factor(redData$age_y)4 2.663e-02 2.029e-02
## as.factor(redData$age_y)5 6.584e-02 2.740e-02
## as.factor(redData$age_y)6 3.883e-02 3.753e-02
## redData$sample_year -3.537e-03 5.988e-03
## as.numeric(paste(redData$sample_interval)) 3.493e-05 4.190e-05
## redData$feed_group2 6.674e-03 1.302e-02
## redData$feed_groupNULL 5.958e-03 1.595e-02
## redData$genetic_groupS 6.433e-03 1.209e-02
## df t value Pr(>|t|)
## (Intercept) 2.419e+02 0.585 0.5590
## as.numeric(paste(redData$residual_rltl_tminus1)) 8.971e+02 6.038 2.28e-09
## as.factor(redData$age_y)0 9.846e+02 1.152 0.2496
## as.factor(redData$age_y)2 9.767e+02 1.838 0.0664
## as.factor(redData$age_y)3 7.254e+02 2.139 0.0328
## as.factor(redData$age_y)4 4.494e+02 1.313 0.1899
## as.factor(redData$age_y)5 4.639e+02 2.403 0.0166
## as.factor(redData$age_y)6 8.328e+02 1.035 0.3011
## redData$sample_year 2.419e+02 -0.591 0.5553
## as.numeric(paste(redData$sample_interval)) 8.644e+02 0.834 0.4047
## redData$feed_group2 1.224e+02 0.513 0.6090
## redData$feed_groupNULL 1.539e+02 0.374 0.7092
## redData$genetic_groupS 1.322e+02 0.532 0.5956
##
## (Intercept)
## as.numeric(paste(redData$residual_rltl_tminus1)) ***
## as.factor(redData$age_y)0
## as.factor(redData$age_y)2 .
## as.factor(redData$age_y)3 *
## as.factor(redData$age_y)4
## as.factor(redData$age_y)5 *
## as.factor(redData$age_y)6
## redData$sample_year
## as.numeric(paste(redData$sample_interval))
## redData$feed_group2
## redData$feed_groupNULL
## redData$genetic_groupS
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation matrix not shown by default, as p = 13 > 12.
## Use print(x, correlation=TRUE) or
## vcov(x) if you need it
anova(mod1)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF
## as.numeric(paste(redData$residual_rltl_tminus1)) 0.56527 0.56527 1 897.13
## as.factor(redData$age_y) 0.13385 0.02231 6 776.02
## redData$sample_year 0.00541 0.00541 1 241.94
## as.numeric(paste(redData$sample_interval)) 0.01077 0.01077 1 864.36
## redData$feed_group 0.00465 0.00232 2 138.88
## redData$genetic_group 0.00439 0.00439 1 132.23
## F value Pr(>F)
## as.numeric(paste(redData$residual_rltl_tminus1)) 36.4591 2.281e-09 ***
## as.factor(redData$age_y) 1.4388 0.1969
## redData$sample_year 0.3488 0.5553
## as.numeric(paste(redData$sample_interval)) 0.6949 0.4047
## redData$feed_group 0.1499 0.8610
## redData$genetic_group 0.2830 0.5956
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Reduce model by removinf non-significant effects.
mod1 <- lmer(as.numeric(paste(redData$residual_rltl_t)) ~
as.numeric(paste(redData$residual_rltl_tminus1)) +
(1|redData$recoded_id), na.action=na.exclude)
summary(mod1)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## as.numeric(paste(redData$residual_rltl_t)) ~ as.numeric(paste(redData$residual_rltl_tminus1)) +
## (1 | redData$recoded_id)
##
## REML criterion at convergence: -1123.1
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.40851 -0.66068 -0.07773 0.53433 2.99380
##
## Random effects:
## Groups Name Variance Std.Dev.
## redData$recoded_id (Intercept) 0.006051 0.07779
## Residual 0.015001 0.12248
## Number of obs: 1019, groups: redData$recoded_id, 305
##
## Fixed effects:
## Estimate Std. Error
## (Intercept) -0.02931 0.00600
## as.numeric(paste(redData$residual_rltl_tminus1)) 0.13180 0.02788
## df t value Pr(>|t|)
## (Intercept) 168.14433 -4.886 2.39e-06
## as.numeric(paste(redData$residual_rltl_tminus1)) 1011.64068 4.727 2.60e-06
##
## (Intercept) ***
## as.numeric(paste(redData$residual_rltl_tminus1)) ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## a.((D$__1)) -0.035
anova(mod1)
## Type III Analysis of Variance Table with Satterthwaite's method
## Sum Sq Mean Sq NumDF DenDF
## as.numeric(paste(redData$residual_rltl_tminus1)) 0.33522 0.33522 1 1011.6
## F value Pr(>F)
## as.numeric(paste(redData$residual_rltl_tminus1)) 22.347 2.598e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# statistical tests for normal distribution of RTL measurements
shapiro.test(as.numeric(paste(uDeadData$herd_life)))
##
## Shapiro-Wilk normality test
##
## data: as.numeric(paste(uDeadData$herd_life))
## W = 0.98408, p-value = 0.008487
ks.test(as.numeric(paste(uDeadData$herd_life)), pnorm)
## Warning in ks.test(as.numeric(paste(uDeadData$herd_life)), pnorm): ties should
## not be present for the Kolmogorov-Smirnov test
##
## One-sample Kolmogorov-Smirnov test
##
## data: as.numeric(paste(uDeadData$herd_life))
## D = 1, p-value < 2.2e-16
## alternative hypothesis: two-sided
qqnorm(as.numeric(paste(uDeadData$herd_life)))
Investigate the effect of average telomere length over life on productive life span:
produc <-as.numeric(paste(uDeadData$amp_305_lactation))
## Warning: NAs introduced by coercion
mod2 <- glm(as.numeric(paste(uDeadData$herd_life)) ~
uDeadData$average_resid +
produc)
summary(mod2)
##
## Call:
## glm(formula = as.numeric(paste(uDeadData$herd_life)) ~ uDeadData$average_resid +
## produc)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -794.08 -361.00 -35.95 311.94 1283.75
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1205.21924 76.16160 15.825 < 2e-16 ***
## uDeadData$average_resid -135.44248 299.38143 -0.452 0.651
## produc 0.07095 0.01075 6.597 4.18e-10 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for gaussian family taken to be 215047.8)
##
## Null deviance: 49655637 on 189 degrees of freedom
## Residual deviance: 40213930 on 187 degrees of freedom
## (51 observations deleted due to missingness)
## AIC: 2877.1
##
## Number of Fisher Scoring iterations: 2
Average telomere length over life is not significantly correlated with productive lifespan. But milk productivity correlates with productive lifespan (animals that live for longer have more opportunity to produce more. But it is an average milk productivity measurement which could also mean that animals that are more productive are kept for longer in the herd)
Average telomere change over life is associated with productive lifespan.
Repeat analysis for animals with more than two samples: uDeadDataMore2
redMore2 <- read.csv("/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/more_2_sampl.csv")
u_red_more_2 <- redMore2[!duplicated(redMore2$recoded_id),]
redDeadMore2 <- subset(redMore2, redMore2$herd_life != "NULL")
uDeadDataMore2 <- redDeadMore2[!duplicated(redDeadMore2$recoded_id),]
product <- as.numeric(paste(uDeadDataMore2$amp_305_lactation))
## Warning: NAs introduced by coercion
mod2 <- glm(as.numeric(paste(uDeadDataMore2$herd_life)) ~
uDeadDataMore2$average_resid +
product)
summary(mod2)
##
## Call:
## glm(formula = as.numeric(paste(uDeadDataMore2$herd_life)) ~ uDeadDataMore2$average_resid +
## product)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -774.53 -377.92 -42.55 335.50 1238.72
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.271e+03 8.264e+01 15.382 < 2e-16 ***
## uDeadDataMore2$average_resid 3.831e+00 3.035e+02 0.013 0.99
## product 6.308e-02 1.133e-02 5.566 9.25e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for gaussian family taken to be 215215.5)
##
## Null deviance: 45657680 on 183 degrees of freedom
## Residual deviance: 38954006 on 181 degrees of freedom
## (29 observations deleted due to missingness)
## AIC: 2786.6
##
## Number of Fisher Scoring iterations: 2
mod3a <- glm(as.numeric(paste(uDeadDataMore2$herd_life)) ~
as.numeric(paste(uDeadDataMore2$rltl_change)) +
product)
summary(mod3a)
##
## Call:
## glm(formula = as.numeric(paste(uDeadDataMore2$herd_life)) ~ as.numeric(paste(uDeadDataMore2$rltl_change)) +
## product)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -787.33 -364.01 -52.38 318.81 1224.01
##
## Coefficients:
## Estimate Std. Error t value
## (Intercept) 1.294e+03 8.446e+01 15.316
## as.numeric(paste(uDeadDataMore2$rltl_change)) 5.775e+02 6.028e+02 0.958
## product 6.238e-02 1.130e-02 5.521
## Pr(>|t|)
## (Intercept) < 2e-16 ***
## as.numeric(paste(uDeadDataMore2$rltl_change)) 0.339
## product 1.16e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for gaussian family taken to be 214130)
##
## Null deviance: 45657680 on 183 degrees of freedom
## Residual deviance: 38757530 on 181 degrees of freedom
## (29 observations deleted due to missingness)
## AIC: 2785.6
##
## Number of Fisher Scoring iterations: 2
AIC(mod3a)
## [1] 2785.623
mod3b <- glm(as.numeric(paste(uDeadDataMore2$herd_life)) ~
as.numeric(paste(uDeadDataMore2$abs_rltl_change)) +
product)
summary(mod3b)
##
## Call:
## glm(formula = as.numeric(paste(uDeadDataMore2$herd_life)) ~ as.numeric(paste(uDeadDataMore2$abs_rltl_change)) +
## product)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -810.56 -386.38 -32.43 326.01 1251.06
##
## Coefficients:
## Estimate Std. Error t value
## (Intercept) 1344.28343 110.91823 12.120
## as.numeric(paste(uDeadDataMore2$abs_rltl_change)) -541.34365 558.66779 -0.969
## product 0.06374 0.01129 5.643
## Pr(>|t|)
## (Intercept) < 2e-16 ***
## as.numeric(paste(uDeadDataMore2$abs_rltl_change)) 0.334
## product 6.34e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for gaussian family taken to be 214105)
##
## Null deviance: 45657680 on 183 degrees of freedom
## Residual deviance: 38753008 on 181 degrees of freedom
## (29 observations deleted due to missingness)
## AIC: 2785.6
##
## Number of Fisher Scoring iterations: 2
AIC(mod3b)
## [1] 2785.601
AIC(mod3b)-AIC(mod3a)
## [1] -0.02147028
#All together
mod3c <- glm(as.numeric(paste(uDeadDataMore2$herd_life)) ~
as.numeric(paste(uDeadDataMore2$rltl_change)) +
as.numeric(paste(uDeadDataMore2$abs_rltl_change)) +
uDeadDataMore2$average_resid +product)
summary(mod3c)
##
## Call:
## glm(formula = as.numeric(paste(uDeadDataMore2$herd_life)) ~ as.numeric(paste(uDeadDataMore2$rltl_change)) +
## as.numeric(paste(uDeadDataMore2$abs_rltl_change)) + uDeadDataMore2$average_resid +
## product)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -813.50 -364.81 -61.04 328.87 1236.41
##
## Coefficients:
## Estimate Std. Error t value
## (Intercept) 1345.44375 114.08909 11.793
## as.numeric(paste(uDeadDataMore2$rltl_change)) 443.74881 644.06446 0.689
## as.numeric(paste(uDeadDataMore2$abs_rltl_change)) -421.00056 595.89616 -0.706
## uDeadDataMore2$average_resid 1.53645 311.59944 0.005
## product 0.06304 0.01140 5.532
## Pr(>|t|)
## (Intercept) < 2e-16 ***
## as.numeric(paste(uDeadDataMore2$rltl_change)) 0.492
## as.numeric(paste(uDeadDataMore2$abs_rltl_change)) 0.481
## uDeadDataMore2$average_resid 0.996
## product 1.11e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for gaussian family taken to be 215903.2)
##
## Null deviance: 45657680 on 183 degrees of freedom
## Residual deviance: 38646678 on 179 degrees of freedom
## (29 observations deleted due to missingness)
## AIC: 2789.1
##
## Number of Fisher Scoring iterations: 2
mod3d <- glm(as.numeric(paste(uDeadDataMore2$herd_life)) ~
as.numeric(paste(uDeadDataMore2$rltl_change)) +
as.numeric(paste(uDeadDataMore2$abs_rltl_change)) +
product)
summary(mod3d)
##
## Call:
## glm(formula = as.numeric(paste(uDeadDataMore2$herd_life)) ~ as.numeric(paste(uDeadDataMore2$rltl_change)) +
## as.numeric(paste(uDeadDataMore2$abs_rltl_change)) + product)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -813.44 -364.72 -60.94 328.88 1236.64
##
## Coefficients:
## Estimate Std. Error t value
## (Intercept) 1345.32218 111.08303 12.111
## as.numeric(paste(uDeadDataMore2$rltl_change)) 444.33049 631.40750 0.704
## as.numeric(paste(uDeadDataMore2$abs_rltl_change)) -420.49044 585.21439 -0.719
## product 0.06305 0.01135 5.554
## Pr(>|t|)
## (Intercept) < 2e-16 ***
## as.numeric(paste(uDeadDataMore2$rltl_change)) 0.483
## as.numeric(paste(uDeadDataMore2$abs_rltl_change)) 0.473
## product 9.92e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for gaussian family taken to be 214703.8)
##
## Null deviance: 45657680 on 183 degrees of freedom
## Residual deviance: 38646683 on 180 degrees of freedom
## (29 observations deleted due to missingness)
## AIC: 2787.1
##
## Number of Fisher Scoring iterations: 2
coxFit <- coxph(Surv(coxData$TimeMeasure, coxData$Event == 1) ~
coxData$average_resid)
summary(coxFit)
## Call:
## coxph(formula = Surv(coxData$TimeMeasure, coxData$Event == 1) ~
## coxData$average_resid)
##
## n= 305, number of events= 241
##
## coef exp(coef) se(coef) z Pr(>|z|)
## coxData$average_resid 0.3407 1.4059 0.5905 0.577 0.564
##
## exp(coef) exp(-coef) lower .95 upper .95
## coxData$average_resid 1.406 0.7113 0.4419 4.473
##
## Concordance= 0.509 (se = 0.021 )
## Likelihood ratio test= 0.33 on 1 df, p=0.6
## Wald test = 0.33 on 1 df, p=0.6
## Score (logrank) test = 0.33 on 1 df, p=0.6
summary(coxFit)$logtest["pvalue"]
## pvalue
## 0.5641153
### discrete scale
coxFit <- coxph(Surv(coxData$TimeMeasure, coxData$Event == 1) ~
coxData$average_resid_3G)
summary(coxFit)
## Call:
## coxph(formula = Surv(coxData$TimeMeasure, coxData$Event == 1) ~
## coxData$average_resid_3G)
##
## n= 305, number of events= 241
##
## coef exp(coef) se(coef) z Pr(>|z|)
## coxData$average_resid_3G 0.01410 1.01420 0.07886 0.179 0.858
##
## exp(coef) exp(-coef) lower .95 upper .95
## coxData$average_resid_3G 1.014 0.986 0.869 1.184
##
## Concordance= 0.501 (se = 0.02 )
## Likelihood ratio test= 0.03 on 1 df, p=0.9
## Wald test = 0.03 on 1 df, p=0.9
## Score (logrank) test = 0.03 on 1 df, p=0.9
#ggsave(file = "/Users/luise/Documents/Work/CattleTelomereLength/AgingCell/Images/MeanRLTL.pdf", print(g2))
#write.csv(coxData, "/Users/luise/Documents/Work/CattleTelomereLength/AgingCell/rawdata/CaxData.csv")
They show the same as Cox proportional hazard models.
dData <- subset(data, data$herd_life != "NULL")
cor.test(as.numeric(paste(dData$herd_life)), dData$abs_rltl_change)
##
## Pearson's product-moment correlation
##
## data: as.numeric(paste(dData$herd_life)) and dData$abs_rltl_change
## t = -5.5853, df = 1020, p-value = 2.991e-08
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.2311491 -0.1121316
## sample estimates:
## cor
## -0.172269
cor.test(as.numeric(paste(dData$herd_life)), dData$rltl_change)
##
## Pearson's product-moment correlation
##
## data: as.numeric(paste(dData$herd_life)) and dData$rltl_change
## t = 8.4519, df = 1020, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.1976120 0.3122569
## sample estimates:
## cor
## 0.2558338
cor.test(as.numeric(paste(dData$herd_life)), dData$average_resid)
##
## Pearson's product-moment correlation
##
## data: as.numeric(paste(dData$herd_life)) and dData$average_resid
## t = -0.19531, df = 1020, p-value = 0.8452
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.06741195 0.05522731
## sample estimates:
## cor
## -0.006115315
tert2 <- ggplot(coxData, aes(
x = as.factor(coxData$abs_rltl_change_3G),
y = abs_rltl_change,
colour = as.factor(coxData$abs_rltl_change_3G)
)) +
geom_boxplot() +
xlab("Mean absolute RLTL change tertile") +
ylab("Mean absolute RLTL change") +
theme_light(20) +
geom_jitter() +
scale_color_manual(values = mycoloursP[35:40]) +
theme(legend.position = "none")
tert3 <- ggplot(coxData, aes(
x = as.factor(coxData$rltl_change_3G),
y = rltl_change,
colour = as.factor(coxData$rltl_change_3G)
)) +
geom_boxplot() +
xlab("Mean RLTL change tertile") +
ylab("Mean RLTL change") +
theme_light(20) +
geom_jitter() +
scale_color_manual(values = mycoloursP[10:40]) +
theme(legend.position = "none")
tert4 <- ggplot(coxData, aes(
x = as.factor(coxData$average_resid_3G),
y = average_resid,
colour = as.factor(coxData$average_resid_3G)
)) +
geom_boxplot() +
xlab("Mean RLTL tertile") +
ylab("Mean RLTL") +
theme_light(20) +
geom_jitter() +
scale_color_manual(values = mycoloursP[5:40]) +
theme(legend.position = "none")
grid.arrange(tert4, tert2, tert3, ncol = 3)
## Warning: Use of `coxData$average_resid_3G` is discouraged. Use
## `average_resid_3G` instead.
## Warning: Use of `coxData$average_resid_3G` is discouraged. Use
## `average_resid_3G` instead.
## Warning: Use of `coxData$average_resid_3G` is discouraged. Use
## `average_resid_3G` instead.
## Warning: Use of `coxData$average_resid_3G` is discouraged. Use
## `average_resid_3G` instead.
## Warning: Use of `coxData$abs_rltl_change_3G` is discouraged. Use
## `abs_rltl_change_3G` instead.
## Warning: Use of `coxData$abs_rltl_change_3G` is discouraged. Use
## `abs_rltl_change_3G` instead.
## Warning: Use of `coxData$abs_rltl_change_3G` is discouraged. Use
## `abs_rltl_change_3G` instead.
## Warning: Use of `coxData$abs_rltl_change_3G` is discouraged. Use
## `abs_rltl_change_3G` instead.
## Warning: Use of `coxData$rltl_change_3G` is discouraged. Use `rltl_change_3G`
## instead.
## Warning: Use of `coxData$rltl_change_3G` is discouraged. Use `rltl_change_3G`
## instead.
## Warning: Use of `coxData$rltl_change_3G` is discouraged. Use `rltl_change_3G`
## instead.
## Warning: Use of `coxData$rltl_change_3G` is discouraged. Use `rltl_change_3G`
## instead.
pdf(file = "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/output/Fig3_ABC.pdf", width = 15, height = 5)
grid.arrange(tert4, tert2, tert3, ncol = 3)
## Warning: Use of `coxData$average_resid_3G` is discouraged. Use
## `average_resid_3G` instead.
## Warning: Use of `coxData$average_resid_3G` is discouraged. Use
## `average_resid_3G` instead.
## Warning: Use of `coxData$average_resid_3G` is discouraged. Use
## `average_resid_3G` instead.
## Warning: Use of `coxData$average_resid_3G` is discouraged. Use
## `average_resid_3G` instead.
## Warning: Use of `coxData$abs_rltl_change_3G` is discouraged. Use
## `abs_rltl_change_3G` instead.
## Warning: Use of `coxData$abs_rltl_change_3G` is discouraged. Use
## `abs_rltl_change_3G` instead.
## Warning: Use of `coxData$abs_rltl_change_3G` is discouraged. Use
## `abs_rltl_change_3G` instead.
## Warning: Use of `coxData$abs_rltl_change_3G` is discouraged. Use
## `abs_rltl_change_3G` instead.
## Warning: Use of `coxData$rltl_change_3G` is discouraged. Use `rltl_change_3G`
## instead.
## Warning: Use of `coxData$rltl_change_3G` is discouraged. Use `rltl_change_3G`
## instead.
## Warning: Use of `coxData$rltl_change_3G` is discouraged. Use `rltl_change_3G`
## instead.
## Warning: Use of `coxData$rltl_change_3G` is discouraged. Use `rltl_change_3G`
## instead.
dev.off()
## quartz_off_screen
## 2
surv_plotlist<-list()
surv_plotlist[[1]] <- meanRLTL
surv_plotlist[[2]] <- mean_abs_rltl_change
surv_plotlist[[3]] <- mean_rltl_change
print(arrange_ggsurvplots(surv_plotlist, print = TRUE, ncol = 3, nrow = 1))
## [[1]]
## NULL
pdf(file = "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/output/Fig3_D.pdf", width = 5, height = 5)
print(meanRLTL)
dev.off()
## quartz_off_screen
## 2
coxFit <- coxph(Surv(coxData$TimeMeasure, coxData$Event == 1)~coxData$av_rltl_1_res)
summary(coxFit)
## Call:
## coxph(formula = Surv(coxData$TimeMeasure, coxData$Event == 1) ~
## coxData$av_rltl_1_res)
##
## n= 284, number of events= 221
## (21 observations deleted due to missingness)
##
## coef exp(coef) se(coef) z Pr(>|z|)
## coxData$av_rltl_1_res -0.9961 0.3693 0.4774 -2.087 0.0369 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## coxData$av_rltl_1_res 0.3693 2.708 0.1449 0.9414
##
## Concordance= 0.544 (se = 0.021 )
## Likelihood ratio test= 4.38 on 1 df, p=0.04
## Wald test = 4.35 on 1 df, p=0.04
## Score (logrank) test = 4.36 on 1 df, p=0.04
coxFit <- coxph(Surv(coxData$TimeMeasure, coxData$Event == 1) ~
coxData$rltl_change +
coxData$average_resid +
coxData$abs_rltl_change)
summary(coxFit)
coxFit <- coxph(Surv(coxDataR$TimeMeasure, coxDataR$Event == 1) ~
coxDataR$average_resid +
as.numeric(paste(coxDataR$amp_305_lactation)))
summary(coxFit)
## Call:
## coxph(formula = Surv(coxDataR$TimeMeasure, coxDataR$Event ==
## 1) ~ coxDataR$average_resid + as.numeric(paste(coxDataR$amp_305_lactation)))
##
## n= 253, number of events= 190
##
## coef exp(coef) se(coef)
## coxDataR$average_resid 2.315e-01 1.260e+00 6.708e-01
## as.numeric(paste(coxDataR$amp_305_lactation)) -9.933e-05 9.999e-01 2.822e-05
## z Pr(>|z|)
## coxDataR$average_resid 0.345 0.730011
## as.numeric(paste(coxDataR$amp_305_lactation)) -3.520 0.000432 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95
## coxDataR$average_resid 1.2605 0.7934 0.3385
## as.numeric(paste(coxDataR$amp_305_lactation)) 0.9999 1.0001 0.9998
## upper .95
## coxDataR$average_resid 4.693
## as.numeric(paste(coxDataR$amp_305_lactation)) 1.000
##
## Concordance= 0.598 (se = 0.023 )
## Likelihood ratio test= 11.93 on 2 df, p=0.003
## Wald test = 12.43 on 2 df, p=0.002
## Score (logrank) test = 12.44 on 2 df, p=0.002
coxFit <- coxph(Surv(coxDataR$TimeMeasure, coxDataR$Event == 1) ~
coxDataR$abs_rltl_change +
as.numeric(paste(coxDataR$amp_305_lactation)))
summary(coxFit)
## Call:
## coxph(formula = Surv(coxDataR$TimeMeasure, coxDataR$Event ==
## 1) ~ coxDataR$abs_rltl_change + as.numeric(paste(coxDataR$amp_305_lactation)))
##
## n= 253, number of events= 190
##
## coef exp(coef) se(coef)
## coxDataR$abs_rltl_change 2.411e+00 1.115e+01 1.146e+00
## as.numeric(paste(coxDataR$amp_305_lactation)) -1.018e-04 9.999e-01 2.818e-05
## z Pr(>|z|)
## coxDataR$abs_rltl_change 2.104 0.035391 *
## as.numeric(paste(coxDataR$amp_305_lactation)) -3.611 0.000305 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95
## coxDataR$abs_rltl_change 11.1466 0.08971 1.1793
## as.numeric(paste(coxDataR$amp_305_lactation)) 0.9999 1.00010 0.9998
## upper .95
## coxDataR$abs_rltl_change 105.4
## as.numeric(paste(coxDataR$amp_305_lactation)) 1.0
##
## Concordance= 0.598 (se = 0.023 )
## Likelihood ratio test= 15.99 on 2 df, p=3e-04
## Wald test = 17.06 on 2 df, p=2e-04
## Score (logrank) test = 17.08 on 2 df, p=2e-04
coxFit <- coxph(Surv(coxDataR$TimeMeasure, coxDataR$Event == 1) ~
coxDataR$rltl_change +
as.numeric(paste(coxDataR$amp_305_lactation)))
summary(coxFit)
## Call:
## coxph(formula = Surv(coxDataR$TimeMeasure, coxDataR$Event ==
## 1) ~ coxDataR$rltl_change + as.numeric(paste(coxDataR$amp_305_lactation)))
##
## n= 253, number of events= 190
##
## coef exp(coef) se(coef)
## coxDataR$rltl_change -5.035e+00 6.506e-03 1.315e+00
## as.numeric(paste(coxDataR$amp_305_lactation)) -9.057e-05 9.999e-01 2.819e-05
## z Pr(>|z|)
## coxDataR$rltl_change -3.829 0.000129 ***
## as.numeric(paste(coxDataR$amp_305_lactation)) -3.212 0.001317 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95
## coxDataR$rltl_change 0.006506 153.7 0.0004944
## as.numeric(paste(coxDataR$amp_305_lactation)) 0.999909 1.0 0.9998542
## upper .95
## coxDataR$rltl_change 0.08562
## as.numeric(paste(coxDataR$amp_305_lactation)) 0.99996
##
## Concordance= 0.601 (se = 0.022 )
## Likelihood ratio test= 25.19 on 2 df, p=3e-06
## Wald test = 28.18 on 2 df, p=8e-07
## Score (logrank) test = 26.7 on 2 df, p=2e-06
coxFit <- coxph(Surv(coxDataR$TimeMeasure, coxDataR$Event == 1) ~
coxDataR$rltl_change +
coxDataR$av_rltl_1_res +
as.numeric(paste(coxDataR$amp_305_lactation)))
summary(coxFit)
## Call:
## coxph(formula = Surv(coxDataR$TimeMeasure, coxDataR$Event ==
## 1) ~ coxDataR$rltl_change + coxDataR$av_rltl_1_res + as.numeric(paste(coxDataR$amp_305_lactation)))
##
## n= 239, number of events= 177
## (14 observations deleted due to missingness)
##
## coef exp(coef) se(coef)
## coxDataR$rltl_change -5.030e+00 6.537e-03 1.379e+00
## coxDataR$av_rltl_1_res -6.552e-01 5.193e-01 5.263e-01
## as.numeric(paste(coxDataR$amp_305_lactation)) -7.896e-05 9.999e-01 2.928e-05
## z Pr(>|z|)
## coxDataR$rltl_change -3.648 0.000264 ***
## coxDataR$av_rltl_1_res -1.245 0.213134
## as.numeric(paste(coxDataR$amp_305_lactation)) -2.696 0.007008 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95
## coxDataR$rltl_change 0.006537 152.972 0.0004382
## coxDataR$av_rltl_1_res 0.519327 1.926 0.1851255
## as.numeric(paste(coxDataR$amp_305_lactation)) 0.999921 1.000 0.9998637
## upper .95
## coxDataR$rltl_change 0.09752
## coxDataR$av_rltl_1_res 1.45685
## as.numeric(paste(coxDataR$amp_305_lactation)) 0.99998
##
## Concordance= 0.595 (se = 0.023 )
## Likelihood ratio test= 22.47 on 3 df, p=5e-05
## Wald test = 25.18 on 3 df, p=1e-05
## Score (logrank) test = 23.85 on 3 df, p=3e-05
!!!!!!! !!!!!!!CHECK THOSE AV_RLTL VALUES… THEY ARE DIFFERENT TO THE ONES IN SUPPLEMENTARY TABLE S30
coxFit <- coxph(Surv(coxDataR$TimeMeasure, coxDataR$Event == 1) ~
coxDataR$rltl_change +
coxDataR$average_resid +
coxDataR$abs_rltl_change +
as.numeric(paste(coxDataR$amp_305_lactation)))
summary(coxFit)
## Call:
## coxph(formula = Surv(coxDataR$TimeMeasure, coxDataR$Event ==
## 1) ~ coxDataR$rltl_change + coxDataR$average_resid + coxDataR$abs_rltl_change +
## as.numeric(paste(coxDataR$amp_305_lactation)))
##
## n= 253, number of events= 190
##
## coef exp(coef) se(coef)
## coxDataR$rltl_change -4.525e+00 1.083e-02 1.387e+00
## coxDataR$average_resid -6.968e-02 9.327e-01 6.840e-01
## coxDataR$abs_rltl_change 1.237e+00 3.447e+00 1.224e+00
## as.numeric(paste(coxDataR$amp_305_lactation)) -9.162e-05 9.999e-01 2.824e-05
## z Pr(>|z|)
## coxDataR$rltl_change -3.262 0.00111 **
## coxDataR$average_resid -0.102 0.91885
## coxDataR$abs_rltl_change 1.011 0.31198
## as.numeric(paste(coxDataR$amp_305_lactation)) -3.244 0.00118 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95
## coxDataR$rltl_change 0.01083 92.3027 0.0007142
## coxDataR$average_resid 0.93269 1.0722 0.2440869
## coxDataR$abs_rltl_change 3.44666 0.2901 0.3130755
## as.numeric(paste(coxDataR$amp_305_lactation)) 0.99991 1.0001 0.9998530
## upper .95
## coxDataR$rltl_change 0.1643
## coxDataR$average_resid 3.5639
## coxDataR$abs_rltl_change 37.9445
## as.numeric(paste(coxDataR$amp_305_lactation)) 1.0000
##
## Concordance= 0.6 (se = 0.022 )
## Likelihood ratio test= 26.21 on 4 df, p=3e-05
## Wald test = 30.41 on 4 df, p=4e-06
## Score (logrank) test = 28.88 on 4 df, p=8e-06
summary(as.numeric(paste(red_data_l_new$diff_rltl_res)))
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## -0.72730 -0.15316 -0.03555 -0.03257 0.08741 0.48019
summary(as.numeric(paste(data$diff_rltl_res)))
## Warning in summary(as.numeric(paste(data$diff_rltl_res))): NAs introduced by
## coercion
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## -0.72730 -0.15310 -0.03538 -0.03243 0.08796 0.48019 305
WHAT IS THAT BELOW??
u_red_data_l_new <- red_data_l_new[!duplicated(red_data_l_new$recoded_id), ]
coxDataL <- data.frame(recoded_id = u_red_data_l_new$recoded_id,
dob = u_red_data_l_new$dob,
herd_life = u_red_data_l_new$herd_life,
cull_date = u_red_data_l_new$cull_date,
average_resid = u_red_data_l_new$average_resid,
rltl_change = u_red_data_l_new$rltl_change,
abs_rltl_change = u_red_data_l_new$abs_rltl_change,
amp_305_lactation = u_red_data_l_new$amp_305_lactation)
coxDataL$CutoffDate <- "01/01/2017"
coxDataL$Event <- ifelse(coxDataL$cull_date == "NULL", 0, 1)
coxDataL$TimeMeasure <- ifelse(coxDataL$Event == 0,
as.Date(coxDataL$CutoffDate, "%d/%m/%Y") -
as.Date(coxDataL$dob, "%d/%m/%Y"),
as.numeric(paste(coxDataL$herd_life)))
## Warning in ifelse(coxDataL$Event == 0, as.Date(coxDataL$CutoffDate, "%d/%m/%Y")
## - : NAs introduced by coercion
coxFit <- coxph(Surv(coxDataL$TimeMeasure, coxDataL$Event == 1) ~ coxDataL$average_resid)
summary(coxFit)
## Call:
## coxph(formula = Surv(coxDataL$TimeMeasure, coxDataL$Event ==
## 1) ~ coxDataL$average_resid)
##
## n= 304, number of events= 240
##
## coef exp(coef) se(coef) z Pr(>|z|)
## coxDataL$average_resid -0.5647 0.5686 0.5667 -0.996 0.319
##
## exp(coef) exp(-coef) lower .95 upper .95
## coxDataL$average_resid 0.5686 1.759 0.1873 1.726
##
## Concordance= 0.524 (se = 0.021 )
## Likelihood ratio test= 1 on 1 df, p=0.3
## Wald test = 0.99 on 1 df, p=0.3
## Score (logrank) test = 0.99 on 1 df, p=0.3
coxFit <- coxph(Surv(coxDataL$TimeMeasure, coxDataL$Event == 1)~coxDataL$abs_rltl_change)
summary(coxFit)
## Call:
## coxph(formula = Surv(coxDataL$TimeMeasure, coxDataL$Event ==
## 1) ~ coxDataL$abs_rltl_change)
##
## n= 304, number of events= 240
##
## coef exp(coef) se(coef) z Pr(>|z|)
## coxDataL$abs_rltl_change 2.7934 16.3372 0.9814 2.846 0.00442 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## coxDataL$abs_rltl_change 16.34 0.06121 2.387 111.8
##
## Concordance= 0.537 (se = 0.023 )
## Likelihood ratio test= 7.49 on 1 df, p=0.006
## Wald test = 8.1 on 1 df, p=0.004
## Score (logrank) test = 8.05 on 1 df, p=0.005
coxFit <- coxph(Surv(coxDataL$TimeMeasure, coxDataL$Event == 1)~coxDataL$rltl_change)
summary(coxFit)
## Call:
## coxph(formula = Surv(coxDataL$TimeMeasure, coxDataL$Event ==
## 1) ~ coxDataL$rltl_change)
##
## n= 304, number of events= 240
##
## coef exp(coef) se(coef) z Pr(>|z|)
## coxDataL$rltl_change -5.065332 0.006312 0.869793 -5.824 5.76e-09 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## coxDataL$rltl_change 0.006312 158.4 0.001148 0.03472
##
## Concordance= 0.572 (se = 0.023 )
## Likelihood ratio test= 26.01 on 1 df, p=3e-07
## Wald test = 33.91 on 1 df, p=6e-09
## Score (logrank) test = 30.05 on 1 df, p=4e-08
#now without first measurement but including milk productivity
#now I will include average milk production, TEL sample number was tested, but removed from the models because it was not statistically associated with productive lifespan
coxDataRL<-subset(coxDataL, coxDataL$amp_305_lactation != "NULL")
#coxDataRL<-merge(coxDataRL, maxSN, by = "recoded_id")
coxFit<-coxph(Surv(coxDataRL$TimeMeasure, coxDataRL$Event == 1)~coxDataRL$average_resid+ as.numeric(paste(coxDataRL$amp_305_lactation)))
summary(coxFit)
## Call:
## coxph(formula = Surv(coxDataRL$TimeMeasure, coxDataRL$Event ==
## 1) ~ coxDataRL$average_resid + as.numeric(paste(coxDataRL$amp_305_lactation)))
##
## n= 253, number of events= 190
##
## coef exp(coef) se(coef)
## coxDataRL$average_resid -4.847e-01 6.159e-01 6.494e-01
## as.numeric(paste(coxDataRL$amp_305_lactation)) -9.853e-05 9.999e-01 2.812e-05
## z Pr(>|z|)
## coxDataRL$average_resid -0.746 0.455445
## as.numeric(paste(coxDataRL$amp_305_lactation)) -3.504 0.000458 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95
## coxDataRL$average_resid 0.6159 1.624 0.1725
## as.numeric(paste(coxDataRL$amp_305_lactation)) 0.9999 1.000 0.9998
## upper .95
## coxDataRL$average_resid 2.199
## as.numeric(paste(coxDataRL$amp_305_lactation)) 1.000
##
## Concordance= 0.599 (se = 0.023 )
## Likelihood ratio test= 12.37 on 2 df, p=0.002
## Wald test = 12.93 on 2 df, p=0.002
## Score (logrank) test = 12.92 on 2 df, p=0.002
coxFit<-coxph(Surv(coxDataRL$TimeMeasure, coxDataRL$Event == 1)~coxDataRL$abs_rltl_change+ as.numeric(paste(coxDataRL$amp_305_lactation)))
summary(coxFit)
## Call:
## coxph(formula = Surv(coxDataRL$TimeMeasure, coxDataRL$Event ==
## 1) ~ coxDataRL$abs_rltl_change + as.numeric(paste(coxDataRL$amp_305_lactation)))
##
## n= 253, number of events= 190
##
## coef exp(coef) se(coef)
## coxDataRL$abs_rltl_change 2.403e+00 1.105e+01 1.147e+00
## as.numeric(paste(coxDataRL$amp_305_lactation)) -1.018e-04 9.999e-01 2.818e-05
## z Pr(>|z|)
## coxDataRL$abs_rltl_change 2.095 0.036134 *
## as.numeric(paste(coxDataRL$amp_305_lactation)) -3.610 0.000306 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95
## coxDataRL$abs_rltl_change 11.0524 0.09048 1.1680
## as.numeric(paste(coxDataRL$amp_305_lactation)) 0.9999 1.00010 0.9998
## upper .95
## coxDataRL$abs_rltl_change 104.6
## as.numeric(paste(coxDataRL$amp_305_lactation)) 1.0
##
## Concordance= 0.598 (se = 0.023 )
## Likelihood ratio test= 15.95 on 2 df, p=3e-04
## Wald test = 17.02 on 2 df, p=2e-04
## Score (logrank) test = 17.04 on 2 df, p=2e-04
coxFit<-coxph(Surv(coxDataRL$TimeMeasure, coxDataRL$Event == 1)~coxDataRL$rltl_change + as.numeric(paste(coxDataRL$amp_305_lactation)))
summary(coxFit)
## Call:
## coxph(formula = Surv(coxDataRL$TimeMeasure, coxDataRL$Event ==
## 1) ~ coxDataRL$rltl_change + as.numeric(paste(coxDataRL$amp_305_lactation)))
##
## n= 253, number of events= 190
##
## coef exp(coef) se(coef)
## coxDataRL$rltl_change -5.056e+00 6.370e-03 1.315e+00
## as.numeric(paste(coxDataRL$amp_305_lactation)) -9.096e-05 9.999e-01 2.818e-05
## z Pr(>|z|)
## coxDataRL$rltl_change -3.844 0.000121 ***
## as.numeric(paste(coxDataRL$amp_305_lactation)) -3.228 0.001247 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95
## coxDataRL$rltl_change 0.00637 157 0.0004836
## as.numeric(paste(coxDataRL$amp_305_lactation)) 0.99991 1 0.9998538
## upper .95
## coxDataRL$rltl_change 0.0839
## as.numeric(paste(coxDataRL$amp_305_lactation)) 1.0000
##
## Concordance= 0.601 (se = 0.022 )
## Likelihood ratio test= 25.3 on 2 df, p=3e-06
## Wald test = 28.32 on 2 df, p=7e-07
## Score (logrank) test = 26.79 on 2 df, p=2e-06
coxFit<-coxph(Surv(coxDataRL$TimeMeasure, coxDataRL$Event == 1)~coxDataRL$rltl_change + coxDataRL$abs_rltl_change+ coxDataRL$average_resid+ as.numeric(paste(coxDataRL$amp_305_lactation)))
summary(coxFit)
See if relationship remains statistically significant when only animals with more than 2 samples are included in the analysis
coxData2<-data.frame(recoded_id=u_red_more_2$recoded_id, dob = u_red_more_2$dob, herd_life = u_red_more_2$herd_life, cull_date = u_red_more_2$cull_date, average_resid_M2 = u_red_more_2$average_resid_M2, rltl_change_M2 = u_red_more_2$rltl_change_M2, abs_rltl_change_M2 = u_red_more_2$abs_rltl_change_M2, amp_305_lactation = u_red_more_2$amp_305_lactation, av_rltl_1_res = u_red_more_2$av_rltl_1_res)
coxData2$CutoffDate<-"01/01/2017"
coxData2$Event<-ifelse(coxData2$cull_date=="NULL", 0, 1)
coxData2$TimeMeasure<-ifelse(coxData2$Event==0, as.Date(coxData2$CutoffDate, "%d/%m/%Y")- as.Date(coxData2$dob, "%d/%m/%Y"), as.numeric(paste(coxData2$herd_life)))
## Warning in ifelse(coxData2$Event == 0, as.Date(coxData2$CutoffDate, "%d/%m/%Y")
## - : NAs introduced by coercion
coxData2$average_resid_3G<-ntile(coxData2$average_resid_M2,3)
coxData2$rltl_change_3G<-ntile(coxData2$rltl_change_M2,3)
coxData2$abs_rltl_change_3G<-ntile(coxData2$abs_rltl_change_M2,3)
# models:
##Average lifetime telomere length
### condinuous variable:
coxFit<-coxph(Surv(coxData2$TimeMeasure, coxData2$Event == 1)~coxData2$average_resid_M2)
summary(coxFit)
## Call:
## coxph(formula = Surv(coxData2$TimeMeasure, coxData2$Event ==
## 1) ~ coxData2$average_resid_M2)
##
## n= 277, number of events= 213
##
## coef exp(coef) se(coef) z Pr(>|z|)
## coxData2$average_resid_M2 -0.5990 0.5494 0.6041 -0.992 0.321
##
## exp(coef) exp(-coef) lower .95 upper .95
## coxData2$average_resid_M2 0.5494 1.82 0.1682 1.795
##
## Concordance= 0.524 (se = 0.022 )
## Likelihood ratio test= 0.99 on 1 df, p=0.3
## Wald test = 0.98 on 1 df, p=0.3
## Score (logrank) test = 0.98 on 1 df, p=0.3
### discrete scale
coxFit<-coxph(Surv(coxData2$TimeMeasure, coxData2$Event == 1)~coxData2$average_resid_3G)
summary(coxFit)
## Call:
## coxph(formula = Surv(coxData2$TimeMeasure, coxData2$Event ==
## 1) ~ coxData2$average_resid_3G)
##
## n= 277, number of events= 213
##
## coef exp(coef) se(coef) z Pr(>|z|)
## coxData2$average_resid_3G -0.10350 0.90168 0.08528 -1.214 0.225
##
## exp(coef) exp(-coef) lower .95 upper .95
## coxData2$average_resid_3G 0.9017 1.109 0.7629 1.066
##
## Concordance= 0.526 (se = 0.021 )
## Likelihood ratio test= 1.47 on 1 df, p=0.2
## Wald test = 1.47 on 1 df, p=0.2
## Score (logrank) test = 1.48 on 1 df, p=0.2
coxFit<-survfit(Surv(coxData2$TimeMeasure, coxData2$Event == 1)~coxData2$average_resid_3G)
#### plot results for discrete scale
survp<- ggsurvplot(coxFit, data=coxData2, pval = TRUE, ggtheme = theme_minimal(), risk.table.y.text.col = T, risk.table.y.text = FALSE, legend.labs=c("Tertile 1 (shortest mean RLTL)", "Tertile 2", "Tertile 3 (longest mean RLTL)"))+theme_survminer(40)
survp
#ggsave(file = "/Users/luise/Documents/Work/CattleTelomereLength/AgingCell/Images/AverageRLTL.pdf", print(survp))
Mean RLTL change
coxFit<-coxph(Surv(coxData2$TimeMeasure, coxData2$Event == 1)~coxData2$rltl_change_M2)
summary(coxFit)
## Call:
## coxph(formula = Surv(coxData2$TimeMeasure, coxData2$Event ==
## 1) ~ coxData2$rltl_change_M2)
##
## n= 277, number of events= 213
##
## coef exp(coef) se(coef) z Pr(>|z|)
## coxData2$rltl_change_M2 -3.46163 0.03138 1.36042 -2.545 0.0109 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## coxData2$rltl_change_M2 0.03138 31.87 0.002181 0.4515
##
## Concordance= 0.544 (se = 0.023 )
## Likelihood ratio test= 6.42 on 1 df, p=0.01
## Wald test = 6.47 on 1 df, p=0.01
## Score (logrank) test = 6.46 on 1 df, p=0.01
### discrete scale
coxFit<-coxph(Surv(coxData2$TimeMeasure, coxData2$Event == 1)~coxData2$rltl_change_3G)
summary(coxFit)
## Call:
## coxph(formula = Surv(coxData2$TimeMeasure, coxData2$Event ==
## 1) ~ coxData2$rltl_change_3G)
##
## n= 277, number of events= 213
##
## coef exp(coef) se(coef) z Pr(>|z|)
## coxData2$rltl_change_3G -0.14184 0.86776 0.08938 -1.587 0.113
##
## exp(coef) exp(-coef) lower .95 upper .95
## coxData2$rltl_change_3G 0.8678 1.152 0.7283 1.034
##
## Concordance= 0.534 (se = 0.021 )
## Likelihood ratio test= 2.52 on 1 df, p=0.1
## Wald test = 2.52 on 1 df, p=0.1
## Score (logrank) test = 2.52 on 1 df, p=0.1
coxFit<-survfit(Surv(coxData2$TimeMeasure, coxData2$Event == 1)~coxData2$rltl_change_3G)
#### plot results for discrete scale
survp<- ggsurvplot(coxFit, data=coxData2, pval = TRUE, ggtheme = theme_minimal(), risk.table.y.text.col = T, risk.table.y.text = FALSE, legend.labs=c("Tertile 1 (most RLTL shortening)", "Tertile 2", "Tertile 3 (least RLTL shortening)"))+theme_survminer(40)
survp
mean absolute RLTL change
coxFit<-coxph(Surv(coxData2$TimeMeasure, coxData2$Event == 1)~coxData2$abs_rltl_change_M2)
summary(coxFit)
## Call:
## coxph(formula = Surv(coxData2$TimeMeasure, coxData2$Event ==
## 1) ~ coxData2$abs_rltl_change_M2)
##
## n= 277, number of events= 213
##
## coef exp(coef) se(coef) z Pr(>|z|)
## coxData2$abs_rltl_change_M2 1.522 4.579 1.159 1.312 0.189
##
## exp(coef) exp(-coef) lower .95 upper .95
## coxData2$abs_rltl_change_M2 4.579 0.2184 0.4719 44.44
##
## Concordance= 0.528 (se = 0.024 )
## Likelihood ratio test= 1.67 on 1 df, p=0.2
## Wald test = 1.72 on 1 df, p=0.2
## Score (logrank) test = 1.72 on 1 df, p=0.2
### discrete scale
coxFit<-coxph(Surv(coxData2$TimeMeasure, coxData2$Event == 1)~coxData2$abs_rltl_change_3G)
summary(coxFit)
## Call:
## coxph(formula = Surv(coxData2$TimeMeasure, coxData2$Event ==
## 1) ~ coxData2$abs_rltl_change_3G)
##
## n= 277, number of events= 213
##
## coef exp(coef) se(coef) z Pr(>|z|)
## coxData2$abs_rltl_change_3G 0.16969 1.18494 0.08624 1.968 0.0491 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## coxData2$abs_rltl_change_3G 1.185 0.8439 1.001 1.403
##
## Concordance= 0.537 (se = 0.021 )
## Likelihood ratio test= 3.88 on 1 df, p=0.05
## Wald test = 3.87 on 1 df, p=0.05
## Score (logrank) test = 3.89 on 1 df, p=0.05
coxFit<-survfit(Surv(coxData2$TimeMeasure, coxData2$Event == 1)~coxData2$abs_rltl_change_3G)
#### plot results for discrete scale
survp<- ggsurvplot(coxFit, data=coxData2, pval = TRUE, ggtheme = theme_minimal(), risk.table.y.text.col = T, risk.table.y.text = FALSE, legend.labs=c("Tertile 1 (least absolute RLTL change)", "Tertile 2", "Tertile 3 (most absolute RLTL change)"))+theme_survminer(40)
survp
Some more figures:
variable_1<-as.numeric(paste(data$sample_interval))
## Warning: NAs introduced by coercion
meanVar_1<-mean(variable_1, na.rm= TRUE)
sdVar<-sd(variable_1, na.rm=TRUE)
samp_int_p<-ggplot(data, aes(x = variable_1)) +
geom_histogram(colour= "black", fill = mycoloursP[7]) + xlab("Sample interval in days") + geom_vline(xintercept= meanVar_1, colour="red")+
theme_classic(20)
samp_int_p
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 305 rows containing non-finite values (stat_bin).
uData<-data[!duplicated(data$recoded_id),]
variable2<-as.factor(paste(uData$birth_year))
yob<-ggplot(uData, aes(x = variable2)) +
geom_bar(colour= "black", fill = mycoloursP[8]) + xlab("Birth year")+ theme_classic(20)
yob
#Average milk production
variable3<-as.numeric(paste(uData$amp_305_lactation))
## Warning: NAs introduced by coercion
meanVar3<-mean(variable3, na.rm= TRUE)
sdVar<-sd(variable3, na.rm=TRUE)
milk_prod<-ggplot(uData, aes(x = variable3)) +
geom_histogram(colour= "black", fill = mycoloursP[9]) + xlab("Average milk production") + geom_vline(xintercept= meanVar3, colour="red")+
theme_classic(20)
milk_prod
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 52 rows containing non-finite values (stat_bin).
grid.arrange(samp_int_p, yob, milk_prod, ncol = 3)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 305 rows containing non-finite values (stat_bin).
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 52 rows containing non-finite values (stat_bin).
grid.arrange(hist2, samp_int_p, milk_prod, prod_lsp_plot, ncol = 2 )
## Warning: Use of `data$residual_rltl_t` is discouraged. Use `residual_rltl_t`
## instead.
## Warning: Use of `data$residual_rltl_t` is discouraged. Use `residual_rltl_t`
## instead.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 305 rows containing non-finite values (stat_bin).
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 52 rows containing non-finite values (stat_bin).
## Warning: Use of `uDeadData$herd_life` is discouraged. Use `herd_life` instead.
## Warning: Use of `uDeadData$herd_life` is discouraged. Use `herd_life` instead.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
# cull reasons
variable<-as.factor(paste(uDeadData$cull_reason))
ggplot(uDeadData, aes(x = variable)) +
geom_bar(colour= "black", fill = mycoloursP[10]) + xlab("Cull reason") +
theme_classic(10)+
theme(axis.text.x = element_text(angle = 90, hjust = 1))
# cull category
variable<-as.factor(paste(uDeadData$cull_catgory))
variable <- factor(variable, levels = c("Fertility & Reproduction",
"Mastitis" ,
"Lameness",
"Died",
"Poor milk yield",
"Accident",
"Herd management",
"Reason unknown"))
uDeadData$cull_disease <- ifelse(uDeadData$cull_catgory == "Herd management" |
uDeadData$cull_catgory == "Accident"|
uDeadData$cull_catgory == "Reason unknown",
"not exclusively health related", "health related")
ggplot(uDeadData, aes(x = variable, fill = cull_disease)) +
geom_bar(colour= "black") + xlab("Cull reason") +
theme_classic(10)+
theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
scale_fill_manual(values = mycoloursP[8:40])+
labs(fill = "Cull category")
# fertility events
newdata <- subset(uData, uData$health_event_fertil_all != "NULL")
variable_f<-as.integer(paste(newdata$health_event_fertil_all))
fert<- ggplot(newdata, aes(x = variable_f)) +
geom_bar(colour= "black", fill = mycoloursP[11]) + xlab("Fertility events")+
theme_classic(20)+
scale_x_continuous(breaks=c(0:12))
#mastitis events
newdata <- subset(uData, uData$health_event_mastitis_all != "NULL")
variable_m<-as.integer(paste(newdata$health_event_mastitis_all))
mast<- ggplot(newdata, aes(x = variable_m)) +
geom_bar(colour= "black", fill = mycoloursP[12]) + xlab("Mastitis events")+
theme_classic(20)+
scale_x_continuous(breaks=c(0:8))
#mast
#lameness events
newdata <- subset(uData, uData$health_event_lame_all != "NULL")
variable_l<-as.integer(paste(newdata$health_event_lame_all))
lame<- ggplot(newdata, aes(x = variable_l)) +
geom_bar(colour= "black", fill = mycoloursP[13]) + xlab("Lameness events")+
theme_classic(20)+
scale_x_continuous(breaks=c(0:11))
grid.arrange(fert, mast, lame, ncol = 3)
#save tables:
tableS1<-as.data.frame(round(coef(summary(init_mod)),3))
tableS2<-as.data.frame(anova(init_mod))
write.csv(tableS1, "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/tableS1.csv")
write.csv(tableS2, "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/tableS2.csv")
#save tables:
tableS3<-as.data.frame(round(coef(summary(late_mod)),3))
tableS4<-as.data.frame(anova(late_mod))
write.csv(tableS3, "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/tableS3.csv")
write.csv(tableS4, "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/tableS4.csv")
#save tables:
tableS5<-as.data.frame(round(coef(summary(red_mod)),3))
tableS6<-as.data.frame(anova(red_mod))
write.csv(tableS5, "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/tableS5.csv")
write.csv(tableS6, "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/tableS6.csv")
#save tables:
tableS7<-as.data.frame(round(coef(summary(red_mod_fac)),3))
tableS8<-as.data.frame(anova(red_mod_fac))
write.csv(tableS7, "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/tableS7.csv")
write.csv(tableS8, "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/tableS8.csv")
Complete dataset:
date_table<- table(data$sample_date)
date_table <- setNames(data.frame(table(data$sample_date)),c("Date","Count"))
date_table$Date<-as.Date(date_table$Date, "%d/%m/%Y")
date_table$Count<-as.numeric(paste(date_table$Count))
ggplot(date_table, aes( x = Date, y= Count)) + geom_line(colour= mycoloursP[19]) + geom_point(colour = mycoloursP[18]) +theme_bw() +
scale_x_date(date_labels="%b", date_breaks="month", expand=c(0,0)) +
facet_grid(~ year(Date), space="free_x", scales="free_x", switch="x") +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
theme(strip.placement = "outside",
strip.background = element_rect(fill=NA,colour="grey50"),
panel.spacing=unit(0,"cm"))
lame_mod<- lm(uDeadData$abs_rltl_change ~ as.numeric(paste(uDeadData$health_event_lame_all)))
## Warning in eval(predvars, data, env): NAs introduced by coercion
summary(lame_mod)
##
## Call:
## lm(formula = uDeadData$abs_rltl_change ~ as.numeric(paste(uDeadData$health_event_lame_all)))
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.13511 -0.04737 -0.00685 0.03400 0.48221
##
## Coefficients:
## Estimate Std. Error t value
## (Intercept) 0.158190 0.008408 18.82
## as.numeric(paste(uDeadData$health_event_lame_all)) -0.004037 0.003082 -1.31
## Pr(>|t|)
## (Intercept) <2e-16 ***
## as.numeric(paste(uDeadData$health_event_lame_all)) 0.192
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.07719 on 140 degrees of freedom
## (99 observations deleted due to missingness)
## Multiple R-squared: 0.01211, Adjusted R-squared: 0.005051
## F-statistic: 1.716 on 1 and 140 DF, p-value: 0.1924
lame_mod_RLTL<- lm(uDeadData$average_resid ~ as.numeric(paste(uDeadData$health_event_lame_all)))
## Warning in eval(predvars, data, env): NAs introduced by coercion
summary(lame_mod_RLTL)
##
## Call:
## lm(formula = uDeadData$average_resid ~ as.numeric(paste(uDeadData$health_event_lame_all)))
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.32760 -0.08116 -0.01310 0.08243 0.42704
##
## Coefficients:
## Estimate Std. Error
## (Intercept) -0.0022188 0.0127342
## as.numeric(paste(uDeadData$health_event_lame_all)) 0.0003725 0.0046674
## t value Pr(>|t|)
## (Intercept) -0.174 0.862
## as.numeric(paste(uDeadData$health_event_lame_all)) 0.080 0.937
##
## Residual standard error: 0.1169 on 140 degrees of freedom
## (99 observations deleted due to missingness)
## Multiple R-squared: 4.549e-05, Adjusted R-squared: -0.007097
## F-statistic: 0.006368 on 1 and 140 DF, p-value: 0.9365
lame_mod_RLTLch<- lm(uDeadData$rltl_change ~ as.numeric(paste(uDeadData$health_event_lame_all)))
## Warning in eval(predvars, data, env): NAs introduced by coercion
summary(lame_mod_RLTLch)
##
## Call:
## lm(formula = uDeadData$rltl_change ~ as.numeric(paste(uDeadData$health_event_lame_all)))
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.59091 -0.03319 0.00155 0.04026 0.17965
##
## Coefficients:
## Estimate Std. Error t value
## (Intercept) -0.049485 0.008693 -5.693
## as.numeric(paste(uDeadData$health_event_lame_all)) 0.005289 0.003186 1.660
## Pr(>|t|)
## (Intercept) 7.06e-08 ***
## as.numeric(paste(uDeadData$health_event_lame_all)) 0.0992 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.0798 on 140 degrees of freedom
## (99 observations deleted due to missingness)
## Multiple R-squared: 0.0193, Adjusted R-squared: 0.0123
## F-statistic: 2.756 on 1 and 140 DF, p-value: 0.09916
mast_mod<- lm(uDeadData$abs_rltl_change ~ as.numeric(paste(uDeadData$health_event_mastitis_all)))
## Warning in eval(predvars, data, env): NAs introduced by coercion
summary(mast_mod)
##
## Call:
## lm(formula = uDeadData$abs_rltl_change ~ as.numeric(paste(uDeadData$health_event_mastitis_all)))
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.12631 -0.04094 -0.01005 0.03472 0.49101
##
## Coefficients:
## Estimate Std. Error
## (Intercept) 0.156041 0.007458
## as.numeric(paste(uDeadData$health_event_mastitis_all)) -0.006652 0.005047
## t value Pr(>|t|)
## (Intercept) 20.924 <2e-16 ***
## as.numeric(paste(uDeadData$health_event_mastitis_all)) -1.318 0.19
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.07718 on 140 degrees of freedom
## (99 observations deleted due to missingness)
## Multiple R-squared: 0.01225, Adjusted R-squared: 0.0052
## F-statistic: 1.737 on 1 and 140 DF, p-value: 0.1897
mast_mod_RLTL<- lm(uDeadData$average_resid ~ as.numeric(paste(uDeadData$health_event_mastitis_all)))
## Warning in eval(predvars, data, env): NAs introduced by coercion
summary(mast_mod_RLTL)
##
## Call:
## lm(formula = uDeadData$average_resid ~ as.numeric(paste(uDeadData$health_event_mastitis_all)))
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.33261 -0.07890 -0.01594 0.07884 0.43394
##
## Coefficients:
## Estimate Std. Error
## (Intercept) 0.002792 0.011272
## as.numeric(paste(uDeadData$health_event_mastitis_all)) -0.005956 0.007629
## t value Pr(>|t|)
## (Intercept) 0.248 0.805
## as.numeric(paste(uDeadData$health_event_mastitis_all)) -0.781 0.436
##
## Residual standard error: 0.1167 on 140 degrees of freedom
## (99 observations deleted due to missingness)
## Multiple R-squared: 0.004336, Adjusted R-squared: -0.002776
## F-statistic: 0.6096 on 1 and 140 DF, p-value: 0.4362
mast_mod_RLTLch<- lm(uDeadData$rltl_change ~ as.numeric(paste(uDeadData$health_event_mastitis_all)))
## Warning in eval(predvars, data, env): NAs introduced by coercion
summary(mast_mod_RLTLch)
##
## Call:
## lm(formula = uDeadData$rltl_change ~ as.numeric(paste(uDeadData$health_event_mastitis_all)))
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.60018 -0.03643 0.01187 0.04075 0.17038
##
## Coefficients:
## Estimate Std. Error
## (Intercept) -0.0404640 0.0077865
## as.numeric(paste(uDeadData$health_event_mastitis_all)) 0.0002443 0.0052699
## t value Pr(>|t|)
## (Intercept) -5.197 7.03e-07 ***
## as.numeric(paste(uDeadData$health_event_mastitis_all)) 0.046 0.963
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.08059 on 140 degrees of freedom
## (99 observations deleted due to missingness)
## Multiple R-squared: 1.535e-05, Adjusted R-squared: -0.007127
## F-statistic: 0.00215 on 1 and 140 DF, p-value: 0.9631
uDeadData$comb_mast_lame <- as.numeric(paste(uDeadData$health_event_mastitis_all)) +
as.numeric(paste(uDeadData$health_event_lame_all))
## Warning: NAs introduced by coercion
## Warning: NAs introduced by coercion
comb_mod<- lm(uDeadData$abs_rltl_change ~ uDeadData$comb_mast_lame)
summary(comb_mod)
##
## Call:
## lm(formula = uDeadData$abs_rltl_change ~ uDeadData$comb_mast_lame)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.13455 -0.04512 -0.00712 0.03201 0.48277
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.162018 0.008961 18.081 <2e-16 ***
## uDeadData$comb_mast_lame -0.004389 0.002517 -1.743 0.0835 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.07683 on 140 degrees of freedom
## (99 observations deleted due to missingness)
## Multiple R-squared: 0.02125, Adjusted R-squared: 0.01426
## F-statistic: 3.04 on 1 and 140 DF, p-value: 0.08345
comb_mod_RLTL<- lm(uDeadData$average_resid ~ uDeadData$comb_mast_lame)
summary(comb_mod_RLTL)
##
## Call:
## lm(formula = uDeadData$average_resid ~ uDeadData$comb_mast_lame)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.33132 -0.07869 -0.01396 0.08067 0.42581
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.001505 0.013630 0.110 0.912
## uDeadData$comb_mast_lame -0.001245 0.003829 -0.325 0.746
##
## Residual standard error: 0.1169 on 140 degrees of freedom
## (99 observations deleted due to missingness)
## Multiple R-squared: 0.0007539, Adjusted R-squared: -0.006384
## F-statistic: 0.1056 on 1 and 140 DF, p-value: 0.7457
comb_mod_RLTLch<- lm(uDeadData$rltl_change ~ uDeadData$comb_mast_lame)
summary(comb_mod_RLTLch)
##
## Call:
## lm(formula = uDeadData$rltl_change ~ uDeadData$comb_mast_lame)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.59478 -0.03429 0.00536 0.04068 0.17578
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.049243 0.009335 -5.275 4.93e-07 ***
## uDeadData$comb_mast_lame 0.003624 0.002623 1.382 0.169
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.08004 on 140 degrees of freedom
## (99 observations deleted due to missingness)
## Multiple R-squared: 0.01345, Adjusted R-squared: 0.006407
## F-statistic: 1.909 on 1 and 140 DF, p-value: 0.1693
Less telomere attrition correlates with more fertility events. While mastatis and lameness events are negative, fertility events include positive outcomes such as an animal seen to show signs of fertility and having a calf.
fer_mod<- lm(uDeadData$abs_rltl_change ~ as.numeric(paste(uDeadData$health_event_fertil_all)))
## Warning in eval(predvars, data, env): NAs introduced by coercion
summary(fer_mod)
##
## Call:
## lm(formula = uDeadData$abs_rltl_change ~ as.numeric(paste(uDeadData$health_event_fertil_all)))
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.14181 -0.04230 -0.00784 0.03398 0.47906
##
## Coefficients:
## Estimate Std. Error
## (Intercept) 0.164882 0.011509
## as.numeric(paste(uDeadData$health_event_fertil_all)) -0.003547 0.002462
## t value Pr(>|t|)
## (Intercept) 14.326 <2e-16 ***
## as.numeric(paste(uDeadData$health_event_fertil_all)) -1.441 0.152
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.07709 on 140 degrees of freedom
## (99 observations deleted due to missingness)
## Multiple R-squared: 0.01461, Adjusted R-squared: 0.007569
## F-statistic: 2.075 on 1 and 140 DF, p-value: 0.1519
fer_mod_RLTL<- lm(uDeadData$average_resid ~ as.numeric(paste(uDeadData$health_event_fertil_all)))
## Warning in eval(predvars, data, env): NAs introduced by coercion
summary(fer_mod_RLTL)
##
## Call:
## lm(formula = uDeadData$average_resid ~ as.numeric(paste(uDeadData$health_event_fertil_all)))
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.34245 -0.08476 -0.01527 0.07784 0.40723
##
## Coefficients:
## Estimate Std. Error
## (Intercept) 0.017591 0.017343
## as.numeric(paste(uDeadData$health_event_fertil_all)) -0.004956 0.003710
## t value Pr(>|t|)
## (Intercept) 1.014 0.312
## as.numeric(paste(uDeadData$health_event_fertil_all)) -1.336 0.184
##
## Residual standard error: 0.1162 on 140 degrees of freedom
## (99 observations deleted due to missingness)
## Multiple R-squared: 0.01259, Adjusted R-squared: 0.005534
## F-statistic: 1.785 on 1 and 140 DF, p-value: 0.1837
fer_mod_RLTLch<- lm(uDeadData$rltl_change ~ as.numeric(paste(uDeadData$health_event_fertil_all)))
## Warning in eval(predvars, data, env): NAs introduced by coercion
summary(fer_mod_RLTLch)
##
## Call:
## lm(formula = uDeadData$rltl_change ~ as.numeric(paste(uDeadData$health_event_fertil_all)))
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.58352 -0.03138 0.00080 0.04107 0.18703
##
## Coefficients:
## Estimate Std. Error
## (Intercept) -0.062661 0.011811
## as.numeric(paste(uDeadData$health_event_fertil_all)) 0.005788 0.002527
## t value Pr(>|t|)
## (Intercept) -5.305 4.3e-07 ***
## as.numeric(paste(uDeadData$health_event_fertil_all)) 2.291 0.0235 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.07912 on 140 degrees of freedom
## (99 observations deleted due to missingness)
## Multiple R-squared: 0.03612, Adjusted R-squared: 0.02924
## F-statistic: 5.247 on 1 and 140 DF, p-value: 0.02348
ggplot(uDeadData, aes(x= as.numeric(paste(uDeadData$health_event_fertil_all)), y= rltl_change)) + geom_point()
## Warning in FUN(X[[i]], ...): NAs introduced by coercion
## Warning in FUN(X[[i]], ...): NAs introduced by coercion
## Warning: Use of `uDeadData$health_event_fertil_all` is discouraged. Use
## `health_event_fertil_all` instead.
## Warning: Removed 99 rows containing missing values (geom_point).
# Fig. Initial change data
in_df<-data.frame(recoded_id = init_change_dat$recoded_id, RLTL = init_change_dat$RLTL0, age= 0, year= init_change_dat$sample_year0)
in_df2<-data.frame(recoded_id = init_change_dat$recoded_id, RLTL = init_change_dat$RLTL1, age= 1, year= init_change_dat$sample_year)
init_df<-rbind(in_df, in_df2)
in_plot1<-ggplot(data = init_df, aes(x = as.factor(init_df$age), y = RLTL, group = recoded_id, colour = recoded_id))+geom_point()+ geom_line()+
xlab("Age in years") + ylab("RLTL residuals") + theme_classic(20)+ theme(legend.position = "none")
in_plot2<-ggplot(data = init_df, aes(x = as.factor(init_df$year), y = RLTL, group = recoded_id, colour = recoded_id))+geom_point()+ geom_line()+
xlab("Age in years") + ylab("RLTL residuals") + theme_classic(20)+ theme(legend.position = "none")
grid.arrange(in_plot1, in_plot2, ncol = 2)
## Warning: Use of `init_df$age` is discouraged. Use `age` instead.
## Warning: Use of `init_df$age` is discouraged. Use `age` instead.
## Warning: Use of `init_df$year` is discouraged. Use `year` instead.
## Warning: Use of `init_df$year` is discouraged. Use `year` instead.
pdf(file = "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/output/Fig1_FG.pdf", width = 10, height = 4)
grid.arrange(in_plot1, in_plot2, ncol = 2)
## Warning: Use of `init_df$age` is discouraged. Use `age` instead.
## Warning: Use of `init_df$age` is discouraged. Use `age` instead.
## Warning: Use of `init_df$year` is discouraged. Use `year` instead.
## Warning: Use of `init_df$year` is discouraged. Use `year` instead.
dev.off()
## quartz_off_screen
## 2
weath_plot_dat<-read.csv("/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/weatherData/eskdalemuirdata_red_plot.csv")
weath_plot_dat<-subset(weath_plot_dat, weath_plot_dat$yyyy > 2005)
weath_plot_dat<-subset(weath_plot_dat, weath_plot_dat$yyyy < 2016)
weath_plot_dat$mm <- ifelse(weath_plot_dat$mm < 10, paste0("0", weath_plot_dat$mm), weath_plot_dat$mm)
weath_plot_dat$date<-paste(weath_plot_dat$yyyy, weath_plot_dat$mm, "01", sep = "-")
weath_plot_dat$date<- as.Date(weath_plot_dat$date)
weath_plot_dat$tmax_degC<-as.numeric(paste(weath_plot_dat$tmax_degC))
w1<-ggplot(weath_plot_dat, aes( x = date, y= tmax_degC)) + geom_line(colour= mycoloursP[20], size = 2) + geom_point(colour = mycoloursP[21], size = 2) +theme_bw(20) +
ylab("Maximum temperature °C")+
xlab("Measurement time point")+
scale_x_date(date_labels="%b", date_breaks="month", expand=c(0,0)) +
facet_grid(~ year(date), space="free_x", scales="free_x", switch="x") +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
theme(strip.placement = "outside",
strip.background = element_rect(fill=NA,colour="grey50"),
panel.spacing=unit(0.4,"cm"))
weath_plot_dat$tmin_degC<-as.numeric(paste(weath_plot_dat$tmin_degC))
w2<-ggplot(weath_plot_dat, aes( x = date, y= tmin_degC)) + geom_line(colour= mycoloursP[22], size = 2) + geom_point(colour = mycoloursP[23], size = 2) +theme_bw(20) +
ylab("Minimum temperature °C")+
xlab("Measurement time point")+
scale_x_date(date_labels="%b", date_breaks="month", expand=c(0,0)) +
facet_grid(~ year(date), space="free_x", scales="free_x", switch="x") +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
theme(strip.placement = "outside",
strip.background = element_rect(fill=NA,colour="grey50"),
panel.spacing=unit(0.4,"cm"))
weath_plot_dat$af_days<-as.numeric(paste(weath_plot_dat$af_days))
w3<-ggplot(weath_plot_dat, aes( x = date, y= af_days)) + geom_line(colour= mycoloursP[24], size = 2) + geom_point(colour = mycoloursP[25], size = 2) +theme_bw(20) +
ylab("Air frost days")+
xlab("Measurement time point")+
scale_x_date(date_labels="%b", date_breaks="month", expand=c(0,0)) +
facet_grid(~ year(date), space="free_x", scales="free_x", switch="x") +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
theme(strip.placement = "outside",
strip.background = element_rect(fill=NA,colour="grey50"),
panel.spacing=unit(0.4,"cm"))
weath_plot_dat$sun_hours_c<-as.numeric(paste(substr(weath_plot_dat$sun_hours,1,nchar(weath_plot_dat$sun_hours)-1)))
w4<-ggplot(weath_plot_dat, aes( x = date, y= sun_hours_c)) + geom_line(colour= mycoloursP[26], size = 2) + geom_point(colour = mycoloursP[27], size = 2) +theme_bw(20) +
ylab("Sun hours per")+
xlab("Measurement time point")+
scale_x_date(date_labels="%b", date_breaks="month", expand=c(0,0)) +
facet_grid(~ year(date), space="free_x", scales="free_x", switch="x") +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
theme(strip.placement = "outside",
strip.background = element_rect(fill=NA,colour="grey50"),
panel.spacing=unit(0.4,"cm"))
weath_plot_dat$rain_mm<-as.numeric(paste(weath_plot_dat$rain_mm))
w5<-ggplot(weath_plot_dat, aes( x = date, y= rain_mm)) + geom_line(colour= mycoloursP[28], size = 2) + geom_point(colour = mycoloursP[29], size = 2) +theme_bw(20) +
ylab("Rain in mm")+
xlab("Measurement time point")+
scale_x_date(date_labels="%b", date_breaks="month", expand=c(0,0)) +
facet_grid(~ year(date), space="free_x", scales="free_x", switch="x") +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
theme(strip.placement = "outside",
strip.background = element_rect(fill=NA,colour="grey50"),
panel.spacing=unit(0.4,"cm"))
grid.arrange(w1, w2, w3, w4, w5, ncol = 1)
pdf(file = "/Users/lseeker/Documents/Work/cattle_telomeres/TelomereChangeInDairyCattle/output/FigS8.pdf", width = 18, height = 25)
grid.arrange(w1, w2, w3, w4, w5, ncol = 1)
dev.off()
## quartz_off_screen
## 2
sessionInfo()
## R version 4.0.2 (2020-06-22)
## Platform: x86_64-apple-darwin17.0 (64-bit)
## Running under: macOS Catalina 10.15.6
##
## Matrix products: default
## BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
##
## locale:
## [1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
##
## attached base packages:
## [1] grid stats graphics grDevices utils datasets methods
## [8] base
##
## other attached packages:
## [1] ggsci_2.9 survminer_0.4.8 ggpubr_0.4.0 survival_3.2-7
## [5] dplyr_1.0.3 plyr_1.8.6 ggthemes_4.2.4 magrittr_2.0.1
## [9] stringr_1.4.0 data.table_1.13.6 mgcv_1.8-33 gridExtra_2.3
## [13] lmerTest_3.1-3 lme4_1.1-26 Matrix_1.3-2 nlme_3.1-151
## [17] ggplot2_3.3.3
##
## loaded via a namespace (and not attached):
## [1] Rcpp_1.0.6 lattice_0.20-41 tidyr_1.1.2
## [4] zoo_1.8-8 assertthat_0.2.1 digest_0.6.27
## [7] R6_2.5.0 cellranger_1.1.0 backports_1.2.1
## [10] evaluate_0.14 pillar_1.4.7 rlang_0.4.10
## [13] curl_4.3 readxl_1.3.1 minqa_1.2.4
## [16] car_3.0-10 nloptr_1.2.2.2 rmarkdown_2.6
## [19] labeling_0.4.2 splines_4.0.2 statmod_1.4.35
## [22] foreign_0.8-81 munsell_0.5.0 broom_0.7.3
## [25] compiler_4.0.2 numDeriv_2016.8-1.1 xfun_0.20
## [28] pkgconfig_2.0.3 htmltools_0.5.1 tidyselect_1.1.0
## [31] tibble_3.0.5 km.ci_0.5-2 rio_0.5.16
## [34] crayon_1.3.4 withr_2.4.0 MASS_7.3-53
## [37] xtable_1.8-4 gtable_0.3.0 lifecycle_0.2.0
## [40] DBI_1.1.1 KMsurv_0.1-5 scales_1.1.1
## [43] zip_2.1.1 stringi_1.5.3 carData_3.0-4
## [46] farver_2.0.3 ggsignif_0.6.0 ellipsis_0.3.1
## [49] survMisc_0.5.5 generics_0.1.0 vctrs_0.3.6
## [52] boot_1.3-25 openxlsx_4.2.3 tools_4.0.2
## [55] forcats_0.5.0 glue_1.4.2 purrr_0.3.4
## [58] hms_1.0.0 abind_1.4-5 yaml_2.2.1
## [61] colorspace_2.0-0 rstatix_0.6.0 knitr_1.30
## [64] haven_2.3.1